Sha256: 9b8dfc427d74051e4626d8bd2dceb203ac4f243b40b8918091d6af518d532b10

Contents?: true

Size: 523 Bytes

Versions: 59

Compression:

Stored size: 523 Bytes

Contents

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

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

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

Version data entries

59 entries across 53 versions & 18 rubygems

Version Path
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
i18n-1.14.1 lib/i18n/locale/tag/parents.rb
i18n-1.14.0 lib/i18n/locale/tag/parents.rb
i18n-1.13.0 lib/i18n/locale/tag/parents.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
i18n-1.12.0 lib/i18n/locale/tag/parents.rb
i18n-1.11.0 lib/i18n/locale/tag/parents.rb
i18n-1.10.0 lib/i18n/locale/tag/parents.rb
i18n-1.9.1 lib/i18n/locale/tag/parents.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/i18n-1.8.10/lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb