Class: TwitterCldr::Shared::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/shared/unit.rb

Constant Summary collapse

DEFAULT_FORM =
:long

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, locale = TwitterCldr.locale) ⇒ Unit

Returns a new instance of Unit.



83
84
85
86
# File 'lib/twitter_cldr/shared/unit.rb', line 83

def initialize(value, locale = TwitterCldr.locale)
  @value = value
  @locale = locale
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



81
82
83
# File 'lib/twitter_cldr/shared/unit.rb', line 81

def locale
  @locale
end

#valueObject (readonly)

Returns the value of attribute value.



81
82
83
# File 'lib/twitter_cldr/shared/unit.rb', line 81

def value
  @value
end

Class Method Details

.create(value, locale = TwitterCldr.locale) ⇒ Object



12
13
14
# File 'lib/twitter_cldr/shared/unit.rb', line 12

def create(value, locale = TwitterCldr.locale)
  subtype_for(locale).new(value, locale)
end

Instance Method Details

#unit_typesObject



88
89
90
# File 'lib/twitter_cldr/shared/unit.rb', line 88

def unit_types
  self.class.send(:all_unit_methods_for, locale)
end