Class: Money::NullCurrency
- Inherits:
-
Object
- Object
- Money::NullCurrency
- Defined in:
- lib/money/null_currency.rb
Instance Attribute Summary collapse
-
#decimal_mark ⇒ Object
readonly
Returns the value of attribute decimal_mark.
-
#disambiguate_symbol ⇒ Object
readonly
Returns the value of attribute disambiguate_symbol.
-
#iso_code ⇒ Object
readonly
Returns the value of attribute iso_code.
-
#iso_numeric ⇒ Object
readonly
Returns the value of attribute iso_numeric.
-
#minor_units ⇒ Object
readonly
Returns the value of attribute minor_units.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#smallest_denomination ⇒ Object
readonly
Returns the value of attribute smallest_denomination.
-
#subunit_symbol ⇒ Object
readonly
Returns the value of attribute subunit_symbol.
-
#subunit_to_unit ⇒ Object
readonly
Returns the value of attribute subunit_to_unit.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
- #compatible?(other) ⇒ Boolean
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize ⇒ NullCurrency
constructor
A new instance of NullCurrency.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ NullCurrency
Returns a new instance of NullCurrency.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/money/null_currency.rb', line 7 def initialize @symbol = '$' @disambiguate_symbol = nil @subunit_symbol = nil @iso_code = 'XXX' # Valid ISO4217 @iso_numeric = '999' @name = 'No Currency' @smallest_denomination = 1 @subunit_to_unit = 100 @minor_units = 2 @decimal_mark = '.' freeze end |
Instance Attribute Details
#decimal_mark ⇒ Object (readonly)
Returns the value of attribute decimal_mark.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def decimal_mark @decimal_mark end |
#disambiguate_symbol ⇒ Object (readonly)
Returns the value of attribute disambiguate_symbol.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def disambiguate_symbol @disambiguate_symbol end |
#iso_code ⇒ Object (readonly)
Returns the value of attribute iso_code.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def iso_code @iso_code end |
#iso_numeric ⇒ Object (readonly)
Returns the value of attribute iso_numeric.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def iso_numeric @iso_numeric end |
#minor_units ⇒ Object (readonly)
Returns the value of attribute minor_units.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def minor_units @minor_units end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def name @name end |
#smallest_denomination ⇒ Object (readonly)
Returns the value of attribute smallest_denomination.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def smallest_denomination @smallest_denomination end |
#subunit_symbol ⇒ Object (readonly)
Returns the value of attribute subunit_symbol.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def subunit_symbol @subunit_symbol end |
#subunit_to_unit ⇒ Object (readonly)
Returns the value of attribute subunit_to_unit.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def subunit_to_unit @subunit_to_unit end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
4 5 6 |
# File 'lib/money/null_currency.rb', line 4 def symbol @symbol end |
Instance Method Details
#compatible?(other) ⇒ Boolean
21 22 23 |
# File 'lib/money/null_currency.rb', line 21 def compatible?(other) other.is_a?(Currency) || other.is_a?(NullCurrency) end |
#eql?(other) ⇒ Boolean Also known as: ==
25 26 27 |
# File 'lib/money/null_currency.rb', line 25 def eql?(other) self.class == other.class && iso_code == other.iso_code end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/money/null_currency.rb', line 29 def to_s '' end |