Class: Dentaku::AST::Identifier
- Defined in:
- lib/dentaku/ast/identifier.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #dependencies(context = {}) ⇒ Object
-
#initialize(token) ⇒ Identifier
constructor
A new instance of Identifier.
- #value(context = {}) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(token) ⇒ Identifier
Returns a new instance of Identifier.
8 9 10 |
# File 'lib/dentaku/ast/identifier.rb', line 8 def initialize(token) @identifier = token.value.downcase end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
6 7 8 |
# File 'lib/dentaku/ast/identifier.rb', line 6 def identifier @identifier end |
Instance Method Details
#dependencies(context = {}) ⇒ Object
25 26 27 |
# File 'lib/dentaku/ast/identifier.rb', line 25 def dependencies(context={}) context.has_key?(identifier) ? dependencies_of(context[identifier]) : [identifier] end |
#value(context = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dentaku/ast/identifier.rb', line 12 def value(context={}) v = context.fetch(identifier) do raise UnboundVariableError.new([identifier]) end case v when Node v.value(context) else v end end |