Class: TwitterCldr::Formatters::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/formatters/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_reader) ⇒ Formatter

Returns a new instance of Formatter.



12
13
14
# File 'lib/twitter_cldr/formatters/formatter.rb', line 12

def initialize(data_reader)
  @data_reader = data_reader
end

Instance Attribute Details

#data_readerObject (readonly)

Returns the value of attribute data_reader.



10
11
12
# File 'lib/twitter_cldr/formatters/formatter.rb', line 10

def data_reader
  @data_reader
end

Instance Method Details

#format(tokens, obj, options = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/twitter_cldr/formatters/formatter.rb', line 16

def format(tokens, obj, options = {})
  tokens.each_with_index.inject("") do |ret, (token, index)|
    method_sym = :"format_#{token.type}"
    ret << send(method_sym, token, index, obj, options)
  end
end