Class: KQL::Accessor::Val
- Inherits:
-
KQL::Accessor
- Object
- KQL::Accessor
- KQL::Accessor::Val
- Defined in:
- lib/kql/accessor.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #execute(node) ⇒ Object
-
#initialize(index) ⇒ Val
constructor
A new instance of Val.
- #match?(node) ⇒ Boolean
Constructor Details
#initialize(index) ⇒ Val
Returns a new instance of Val.
6 7 8 |
# File 'lib/kql/accessor.rb', line 6 def initialize(index) @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
4 5 6 |
# File 'lib/kql/accessor.rb', line 4 def index @index end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 22 |
# File 'lib/kql/accessor.rb', line 18 def ==(other) return false unless other.is_a?(Val) other.index == index end |
#execute(node) ⇒ Object
10 11 12 |
# File 'lib/kql/accessor.rb', line 10 def execute(node) node.arguments[index] end |
#match?(node) ⇒ Boolean
14 15 16 |
# File 'lib/kql/accessor.rb', line 14 def match?(node) node.arguments.size > index end |