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

- (Simple) initialize(*tag)



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

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

Instance Attribute Details

- (Object) tag (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

+ (Object) tag(tag)



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

def tag(tag)
  new(tag)
end

Instance Method Details

- (Object) subtags



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

- (Object) to_a



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

def to_a
  subtags
end

- (Object) to_s



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

def to_s
  tag.to_s
end

- (Object) to_sym



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

def to_sym
  tag
end