Class: Lolita::Translation::Locale

Inherits:
Object
  • Object
show all
Defined in:
lib/lolita-translation/locale.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject 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

Returns:

  • (Boolean)


20
21
22
# File 'lib/lolita-translation/locale.rb', line 20

def active?
  self.name == current_locale
end

#humanized_short_nameObject



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