Class: I18n::Locale::Tag::Simple

Inherits:
Object
  • Object
show all
Includes:
Parents
Defined in:
lib/i18n/locale/tag/simple.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Parents

#parent, #parents, #self_and_parents

Constructor Details

#initialize(*tag) ⇒ Simple



17
18
19
# File 'lib/i18n/locale/tag/simple.rb', line 17

def initialize(*tag)
  @tag = tag.join('-').to_sym
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag



15
16
17
# File 'lib/i18n/locale/tag/simple.rb', line 15

def tag
  @tag
end

Class Method Details

.tag(tag) ⇒ Object



8
9
10
# File 'lib/i18n/locale/tag/simple.rb', line 8

def tag(tag)
  new(tag)
end

Instance Method Details

#subtagsObject



21
22
23
# File 'lib/i18n/locale/tag/simple.rb', line 21

def subtags
  @subtags = tag.to_s.split('-').map { |subtag| subtag.to_s }
end

#to_aObject



33
34
35
# File 'lib/i18n/locale/tag/simple.rb', line 33

def to_a
  subtags
end

#to_sObject



29
30
31
# File 'lib/i18n/locale/tag/simple.rb', line 29

def to_s
  tag.to_s
end

#to_symObject



25
26
27
# File 'lib/i18n/locale/tag/simple.rb', line 25

def to_sym
  tag
end