Class: KQL::Matcher::Value

Inherits:
KQL::Matcher show all
Defined in:
lib/kql/matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Value

Returns a new instance of Value.



44
45
46
# File 'lib/kql/matcher.rb', line 44

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



42
43
44
# File 'lib/kql/matcher.rb', line 42

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



48
49
50
51
52
# File 'lib/kql/matcher.rb', line 48

def ==(other)
  return false unless other.is_a?(Value)

  other.value == value
end

#coerce(a) ⇒ Object



54
55
56
57
58
59
# File 'lib/kql/matcher.rb', line 54

def coerce(a)
  case a
  when ::KDL::Value then a.value
  else a
  end
end