Class: Lolita::Translation::Locale
- Inherits:
-
Object
- Object
- Lolita::Translation::Locale
- Defined in:
- lib/lolita-translation/locale.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #short_name)
Returns the value of attribute name.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #humanized_short_name ⇒ Object
-
#initialize(name) ⇒ Locale
constructor
A new instance of Locale.
Constructor Details
#initialize(name) ⇒ Locale
Returns a new instance of Locale.
10 11 12 |
# File 'lib/lolita-translation/locale.rb', line 10 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object Also known as: short_name
Returns the value of attribute name.
7 8 9 |
# File 'lib/lolita-translation/locale.rb', line 7 def name @name end |
Instance Method Details
#active? ⇒ Boolean
20 21 22 |
# File 'lib/lolita-translation/locale.rb', line 20 def active? self.name == current_locale end |
#humanized_short_name ⇒ Object
14 15 16 17 18 |
# File 'lib/lolita-translation/locale.rb', line 14 def humanized_short_name self.name.to_s.sub(/^(\w{1})(\w+)/) do "#{$1.to_s.upcase}#{$2}" end end |