Module: Money::Formatter

Included in:
CurrencyName, CurrencySymbol, DecimalMark, DisplayFree, NoCents, ThousandSeparator
Defined in:
lib/money/formatter.rb

Defined Under Namespace

Classes: CurrencyName, CurrencySymbol, DecimalMark, DisplayFree, NoCents, ThousandSeparator

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/money/formatter.rb', line 9

def method_missing(method, *args, &block)
  begin
    @options[:previous].send(method, args, &block)
  rescue
    @options[:previous].send(method, &block)
  end
end

Instance Method Details

#formatObject



2
3
4
5
6
7
# File 'lib/money/formatter.rb', line 2

def format
  new_string = self.class_format
  params = @options.dup.merge(:previous => self, :formatted_string => new_string)
  return next_formatter.new(params).format if next_formatter
  return new_string
end

#formattedObject



17
18
19
# File 'lib/money/formatter.rb', line 17

def formatted
  @options[:formatted_string]
end

#rulesObject



21
22
23
# File 'lib/money/formatter.rb', line 21

def rules
  @options[:rules] || {}
end