Module: I18n::Locale::Tag::Parents

Included in:
Rfc4646, Simple
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb

Instance Method Summary collapse

Instance Method Details

#parentObject



5
6
7
8
9
10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb', line 5

def parent
  @parent ||=
    begin
      segs = to_a
      segs.compact!
      segs.length > 1 ? self.class.tag(*segs[0..(segs.length - 2)].join('-')) : nil
    end
end

#parentsObject



18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb', line 18

def parents
  @parents ||= parent ? [parent].concat(parent.parents) : []
end

#self_and_parentsObject



14
15
16
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb', line 14

def self_and_parents
  @self_and_parents ||= [self].concat parents
end