Class: Validate::Compare::ToValue

Inherits:
Object
  • Object
show all
Includes:
Comparable, TransformUsing
Defined in:
lib/validate/compare.rb

Instance Method Summary collapse

Methods included from TransformUsing

#using

Constructor Details

#initialize(value_block) ⇒ ToValue

Returns a new instance of ToValue.



55
56
57
# File 'lib/validate/compare.rb', line 55

def initialize(value_block)
  @value_block = value_block
end

Instance Method Details

#<=>(other) ⇒ Object



59
60
61
# File 'lib/validate/compare.rb', line 59

def <=>(other)
  @value_block.call <=> other
end

#to_sObject



63
64
65
# File 'lib/validate/compare.rb', line 63

def to_s
  '<dynamic value>'
end