Class: Money::Formatter::CurrencySymbol
- Inherits:
-
Object
- Object
- Money::Formatter::CurrencySymbol
- Includes:
- Money::Formatter
- Defined in:
- lib/money/formatter/currency_symbol.rb
Instance Method Summary collapse
- #class_format ⇒ Object
-
#initialize(options) ⇒ CurrencySymbol
constructor
A new instance of CurrencySymbol.
- #next_formatter ⇒ Object
- #symbol_not_defined_by_user? ⇒ Boolean
Methods included from Money::Formatter
#format, #formatted, #method_missing, #rules
Constructor Details
#initialize(options) ⇒ CurrencySymbol
Returns a new instance of CurrencySymbol.
4 5 6 7 |
# File 'lib/money/formatter/currency_symbol.rb', line 4 def initialize() @options = @symbol_value, @symbol_position = symbol_value(rules), symbol_position end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Money::Formatter
Instance Method Details
#class_format ⇒ Object
16 17 18 19 |
# File 'lib/money/formatter/currency_symbol.rb', line 16 def class_format return formatted if symbol_not_defined_by_user? add_symbol if @symbol_value && !@symbol_value.empty? end |
#next_formatter ⇒ Object
21 22 23 |
# File 'lib/money/formatter/currency_symbol.rb', line 21 def next_formatter Money::Formatter::DecimalMark end |
#symbol_not_defined_by_user? ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/money/formatter/currency_symbol.rb', line 9 def symbol_not_defined_by_user? if rules.has_key? :symbol return rules[:symbol] === false || rules[:symbol].nil? || rules[:symbol] == '' end true end |