Class: Money::Formatter::DisplayFree
- Inherits:
-
Object
- Object
- Money::Formatter::DisplayFree
- Includes:
- Money::Formatter
- Defined in:
- lib/money/formatter/display_free.rb
Instance Method Summary collapse
- #class_format ⇒ Object
-
#initialize(options) ⇒ DisplayFree
constructor
A new instance of DisplayFree.
- #next_formatter ⇒ Object
Methods included from Money::Formatter
#format, #formatted, #method_missing, #rules
Constructor Details
#initialize(options) ⇒ DisplayFree
Returns a new instance of DisplayFree.
4 5 6 7 |
# File 'lib/money/formatter/display_free.rb', line 4 def initialize() @options = @display_free = rules[:display_free] || false if rules 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
9 10 11 12 13 14 |
# File 'lib/money/formatter/display_free.rb', line 9 def class_format return formatted if cents > 0 return @display_free if @display_free.respond_to?(:to_str) return "free" if @display_free return formatted end |
#next_formatter ⇒ Object
16 17 18 |
# File 'lib/money/formatter/display_free.rb', line 16 def next_formatter Money::Formatter::ThousandSeparator end |