Class: Curlybars::Node::Variable
- Inherits:
-
Struct
- Object
- Struct
- Curlybars::Node::Variable
- Defined in:
- lib/curlybars/node/variable.rb
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
-
#variable ⇒ Object
Returns the value of attribute variable.
Instance Method Summary collapse
- #cache_key ⇒ Object
- #compile ⇒ Object
- #validate(branches, check_type: :anything) ⇒ Object
- #validate_as_value(branches) ⇒ Object
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position
3 4 5 |
# File 'lib/curlybars/node/variable.rb', line 3 def position @position end |
#variable ⇒ Object
Returns the value of attribute variable
3 4 5 |
# File 'lib/curlybars/node/variable.rb', line 3 def variable @variable end |
Instance Method Details
#cache_key ⇒ Object
26 27 28 29 30 31 |
# File 'lib/curlybars/node/variable.rb', line 26 def cache_key [ variable, self.class.name ].join("/") end |
#compile ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/curlybars/node/variable.rb', line 4 def compile # NOTE: the following is a heredoc string, representing the ruby code fragment # outputted by this node. <<-RUBY -> { position = rendering.position( #{position.line_number}, #{position.line_offset} ) rendering.variable(#{variable.inspect}, position) } RUBY end |
#validate(branches, check_type: :anything) ⇒ Object
18 19 20 |
# File 'lib/curlybars/node/variable.rb', line 18 def validate(branches, check_type: :anything) # Nothing to validate here. end |
#validate_as_value(branches) ⇒ Object
22 23 24 |
# File 'lib/curlybars/node/variable.rb', line 22 def validate_as_value(branches) # It is always a value. end |