Class: TwitterCldr::DataReaders::TimespanDataReader
- Inherits:
-
DataReader
- Object
- DataReader
- TwitterCldr::DataReaders::TimespanDataReader
- Defined in:
- lib/twitter_cldr/data_readers/timespan_data_reader.rb
Constant Summary collapse
- DEFAULT_DIRECTION =
:ago
- DEFAULT_TYPE =
:default
- VALID_FIELDS =
[:second, :minute, :hour, :day, :week, :month, :year]
- BASE_PATH =
[:fields]
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#plural_rule ⇒ Object
readonly
Returns the value of attribute plural_rule.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Attributes inherited from DataReader
Instance Method Summary collapse
- #formatter ⇒ Object
-
#initialize(locale, seconds, options = {}) ⇒ TimespanDataReader
constructor
A new instance of TimespanDataReader.
- #pattern ⇒ Object
- #tokenizer ⇒ Object
Methods inherited from DataReader
Constructor Details
#initialize(locale, seconds, options = {}) ⇒ TimespanDataReader
Returns a new instance of TimespanDataReader.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 16 def initialize(locale, seconds, = {}) super(locale) @type = [:type] || DEFAULT_TYPE @direction = [:direction] || DEFAULT_DIRECTION @unit = [:unit] @plural_rule = [:plural_rule] || TwitterCldr::Formatters::Plurals::Rules.rule_for(seconds, locale) end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
14 15 16 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 14 def direction @direction end |
#plural_rule ⇒ Object (readonly)
Returns the value of attribute plural_rule.
14 15 16 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 14 def plural_rule @plural_rule end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 14 def type @type end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
14 15 16 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 14 def unit @unit end |
Instance Method Details
#formatter ⇒ Object
35 36 37 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 35 def formatter @formatter ||= TwitterCldr::Formatters::TimespanFormatter.new(self) end |
#pattern ⇒ Object
27 28 29 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 27 def pattern traverse(path) end |
#tokenizer ⇒ Object
31 32 33 |
# File 'lib/twitter_cldr/data_readers/timespan_data_reader.rb', line 31 def tokenizer @tokenizer ||= TwitterCldr::Tokenizers::TimespanTokenizer.new(self) end |