Module: Canned::Context::Matchers::Equality

Included in:
Value
Defined in:
lib/canned/context/matchers/equality.rb

Instance Method Summary collapse

Instance Method Details

#equal_to(_options = {}) ⇒ Object

Returns true if a given value equals current context value.

Parameters:

  • _value (Object)

    to compare to.

  • _options (Hash) (defaults to: {})

    various options:

    • own: if set, context value is compared to the closest containing actor context attribute own.



12
13
14
15
# File 'lib/canned/context/matchers/equality.rb', line 12

def equal_to(_options={})
  return false unless indeed?
  @stack.top == _equality_load_value(_options)
end

#greater_than(_options = {}) ⇒ Object

Works the same as equal_to but performs a greater_than comparison



18
19
20
21
# File 'lib/canned/context/matchers/equality.rb', line 18

def greater_than(_options={})
  return false unless indeed?
  @stack.top > _equality_load_value(_options)
end

#less_than(_options = {}) ⇒ Object

Works the same as equal_to but performs a less_than comparison



24
25
26
27
# File 'lib/canned/context/matchers/equality.rb', line 24

def less_than(_options={})
  return false unless indeed?
  @stack.top < _equality_load_value(_options)
end