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
i18n-1.14.6 lib/i18n/locale/tag/parents.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.5/lib/i18n/locale/tag/parents.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/locale/tag/parents.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/locale/tag/parents.rb
i18n-1.14.5 lib/i18n/locale/tag/parents.rb
i18n-1.14.4 lib/i18n/locale/tag/parents.rb
i18n-1.14.3 lib/i18n/locale/tag/parents.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.10.0/lib/i18n/locale/tag/parents.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/locale/tag/parents.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.10.0/lib/i18n/locale/tag/parents.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/locale/tag/parents.rb