Class: TwitterCldr::Localized::LocalizedObject
- Inherits:
-
Object
- Object
- TwitterCldr::Localized::LocalizedObject
- Defined in:
- lib/twitter_cldr/localized/localized_object.rb
Direct Known Subclasses
LocalizedArray, LocalizedDateTime, LocalizedHash, LocalizedNumber, LocalizedString, LocalizedSymbol, LocalizedTimespan
Instance Attribute Summary collapse
-
#base_obj ⇒ Object
readonly
Returns the value of attribute base_obj.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(obj, locale, options = {}) ⇒ LocalizedObject
constructor
A new instance of LocalizedObject.
Constructor Details
#initialize(obj, locale, options = {}) ⇒ LocalizedObject
Returns a new instance of LocalizedObject.
13 14 15 16 17 18 19 20 |
# File 'lib/twitter_cldr/localized/localized_object.rb', line 13 def initialize(obj, locale, = {}) @base_obj = obj @locale = TwitterCldr.convert_locale(locale) @locale = TwitterCldr::DEFAULT_LOCALE unless TwitterCldr.supported_locale?(@locale) = .dup [:locale] = @locale end |
Instance Attribute Details
#base_obj ⇒ Object (readonly)
Returns the value of attribute base_obj.
11 12 13 |
# File 'lib/twitter_cldr/localized/localized_object.rb', line 11 def base_obj @base_obj end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
11 12 13 |
# File 'lib/twitter_cldr/localized/localized_object.rb', line 11 def formatter @formatter end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
11 12 13 |
# File 'lib/twitter_cldr/localized/localized_object.rb', line 11 def locale @locale end |
Class Method Details
.localize(klass) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/twitter_cldr/localized/localized_object.rb', line 22 def self.localize(klass) klass.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1 def localize(locale = TwitterCldr.locale, options = {}) #{self}.new(self, locale, options) end LOCALIZE end |