Class: Wesabe::Currency
Instance Attribute Summary collapse
-
#decimal_places ⇒ Object
(also: #precision)
Returns the value of attribute decimal_places.
-
#delimiter ⇒ Object
Returns the value of attribute delimiter.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Attributes inherited from BaseModel
Class Method Summary collapse
-
.from_xml(xml) ⇒ Wesabe::Currency
Returns a
Wesabe::Currency
generated from Wesabe’s API XML.
Instance Method Summary collapse
-
#initialize {|currency| ... } ⇒ Currency
constructor
Initializes a
Wesabe::Currency
and yields itself. - #inspect ⇒ Object
Methods inherited from BaseModel
Methods included from Util
Constructor Details
#initialize {|currency| ... } ⇒ Currency
Initializes a Wesabe::Currency
and yields itself.
8 9 10 |
# File 'lib/wesabe/currency.rb', line 8 def initialize yield self if block_given? end |
Instance Attribute Details
#decimal_places ⇒ Object Also known as: precision
Returns the value of attribute decimal_places.
2 3 4 |
# File 'lib/wesabe/currency.rb', line 2 def decimal_places @decimal_places end |
#delimiter ⇒ Object
Returns the value of attribute delimiter.
2 3 4 |
# File 'lib/wesabe/currency.rb', line 2 def delimiter @delimiter end |
#separator ⇒ Object
Returns the value of attribute separator.
2 3 4 |
# File 'lib/wesabe/currency.rb', line 2 def separator @separator end |
#symbol ⇒ Object
Returns the value of attribute symbol.
2 3 4 |
# File 'lib/wesabe/currency.rb', line 2 def symbol @symbol end |
Class Method Details
.from_xml(xml) ⇒ Wesabe::Currency
Returns a Wesabe::Currency
generated from Wesabe’s API XML.
22 23 24 25 26 27 28 29 |
# File 'lib/wesabe/currency.rb', line 22 def self.from_xml(xml) new do |currency| currency.decimal_places = xml[:decimal_places].to_s.to_i currency.symbol = xml[:symbol].to_s currency.separator = xml[:separator].to_s currency.delimiter = xml[:delimiter].to_s end end |
Instance Method Details
#inspect ⇒ Object
31 32 33 |
# File 'lib/wesabe/currency.rb', line 31 def inspect inspect_these :symbol, :decimal_places, :separator, :delimiter end |