Class: HumanValue::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/human_value/value.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Value

Returns a new instance of Value.



7
8
9
# File 'lib/human_value/value.rb', line 7

def initialize(raw)
  @raw = raw
end

Class Method Details

.wrap(objects) ⇒ Object



3
4
5
# File 'lib/human_value/value.rb', line 3

def self.wrap(objects)
  objects.map{ |object| new(object) }
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
# File 'lib/human_value/value.rb', line 11

def to_s
  HumanValue.humanizations.each do |humanization|
    return humanization.call(raw) if humanization.matches?(raw)
  end

  raw.to_s
end