Class: KQL::Accessor::Prop
- Inherits:
-
KQL::Accessor
- Object
- KQL::Accessor
- KQL::Accessor::Prop
- Defined in:
- lib/kql/accessor.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #execute(node) ⇒ Object
-
#initialize(name) ⇒ Prop
constructor
A new instance of Prop.
- #match?(node) ⇒ Boolean
Constructor Details
#initialize(name) ⇒ Prop
Returns a new instance of Prop.
28 29 30 |
# File 'lib/kql/accessor.rb', line 28 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/kql/accessor.rb', line 26 def name @name end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 43 44 |
# File 'lib/kql/accessor.rb', line 40 def ==(other) return false unless other.is_a?(Prop) other.name == name end |
#execute(node) ⇒ Object
32 33 34 |
# File 'lib/kql/accessor.rb', line 32 def execute(node) node.properties[name] end |
#match?(node) ⇒ Boolean
36 37 38 |
# File 'lib/kql/accessor.rb', line 36 def match?(node) node.properties.key?(name) end |