Class: TwitterCldr::Formatters::ListFormatter
- Defined in:
- lib/twitter_cldr/formatters/list_formatter.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
Returns the value of attribute locale.
Attributes inherited from Formatter
Instance Method Summary collapse
- #format(list, type = :default) ⇒ Object
-
#initialize(locale = TwitterCldr.locale) ⇒ ListFormatter
constructor
A new instance of ListFormatter.
- #types ⇒ Object
Constructor Details
#initialize(locale = TwitterCldr.locale) ⇒ ListFormatter
Returns a new instance of ListFormatter.
12 13 14 |
# File 'lib/twitter_cldr/formatters/list_formatter.rb', line 12 def initialize(locale = TwitterCldr.locale) @locale = TwitterCldr.convert_locale(locale) end |
Instance Attribute Details
#locale ⇒ Object
Returns the value of attribute locale.
10 11 12 |
# File 'lib/twitter_cldr/formatters/list_formatter.rb', line 10 def locale @locale end |
Instance Method Details
#format(list, type = :default) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/twitter_cldr/formatters/list_formatter.rb', line 16 def format(list, type = :default) if res = resource_for_type(type) if res.include?(:"#{list.size}") compose(res[:"#{list.size}"], list) else compose_list(list, res) end end end |
#types ⇒ Object
26 27 28 |
# File 'lib/twitter_cldr/formatters/list_formatter.rb', line 26 def types resource.keys end |