Class: Money::NullCurrency

Inherits:
Object
  • Object
show all
Defined in:
lib/money/null_currency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNullCurrency

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_markObject (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_symbolObject (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_codeObject (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_numericObject (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_unitsObject (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

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/money/null_currency.rb', line 4

def name
  @name
end

#smallest_denominationObject (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_symbolObject (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_unitObject (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

#symbolObject (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

Returns:

  • (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: ==

Returns:

  • (Boolean)


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_sObject



29
30
31
# File 'lib/money/null_currency.rb', line 29

def to_s
  ''
end