Class: Papercraft::BuiltinNode
- Inherits:
-
Object
- Object
- Papercraft::BuiltinNode
- Defined in:
- lib/papercraft/compiler/nodes.rb
Overview
Represents a builtin call
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#call_node ⇒ Object
readonly
Returns the value of attribute call_node.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(call_node, translator) ⇒ BuiltinNode
constructor
A new instance of BuiltinNode.
Constructor Details
#initialize(call_node, translator) ⇒ BuiltinNode
Returns a new instance of BuiltinNode.
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/papercraft/compiler/nodes.rb', line 154 def initialize(call_node, translator) @call_node = call_node @tag = call_node.name @location = call_node.location @block = call_node.block && translator.visit(call_node.block) args = call_node.arguments&.arguments return if !args if args.size == 1 && args.first.is_a?(Prism::KeywordHashNode) @attributes = args.first end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
152 153 154 |
# File 'lib/papercraft/compiler/nodes.rb', line 152 def attributes @attributes end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
152 153 154 |
# File 'lib/papercraft/compiler/nodes.rb', line 152 def block @block end |
#call_node ⇒ Object (readonly)
Returns the value of attribute call_node.
152 153 154 |
# File 'lib/papercraft/compiler/nodes.rb', line 152 def call_node @call_node end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
152 153 154 |
# File 'lib/papercraft/compiler/nodes.rb', line 152 def location @location end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
152 153 154 |
# File 'lib/papercraft/compiler/nodes.rb', line 152 def tag @tag end |
Instance Method Details
#accept(visitor) ⇒ Object
168 169 170 |
# File 'lib/papercraft/compiler/nodes.rb', line 168 def accept(visitor) visitor.visit_builtin_node(self) end |