Class: Worldwide::Cldr::DateFormatPattern::Field
- Inherits:
-
Object
- Object
- Worldwide::Cldr::DateFormatPattern::Field
show all
- Defined in:
- lib/worldwide/cldr/date_format_pattern.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(pattern) ⇒ Field
91
92
93
|
# File 'lib/worldwide/cldr/date_format_pattern.rb', line 91
def initialize(pattern)
@pattern = pattern
end
|
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
89
90
91
|
# File 'lib/worldwide/cldr/date_format_pattern.rb', line 89
def pattern
@pattern
end
|
Class Method Details
.from(pattern) ⇒ Object
83
84
85
86
|
# File 'lib/worldwide/cldr/date_format_pattern.rb', line 83
def from(pattern)
klass = Worldwide::Cldr::DateFormatPattern::FIELD_CLASSES[pattern[0].to_sym] || Field
klass.new(pattern)
end
|
Instance Method Details
95
96
97
|
# File 'lib/worldwide/cldr/date_format_pattern.rb', line 95
def format(date, locale: I18n.locale)
raise NotImplementedError, "Unimplemented field: #{pattern}"
end
|