Class: KQL::Accessor::Prop

Inherits:
KQL::Accessor show all
Defined in:
lib/kql/accessor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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

Returns:

  • (Boolean)


36
37
38
# File 'lib/kql/accessor.rb', line 36

def match?(node)
  node.properties.key?(name)
end