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
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb
i18n-1.8.11 lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/i18n-1.8.10/lib/i18n/locale/tag/parents.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/i18n-1.8.10/lib/i18n/locale/tag/parents.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.10/lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/i18n-1.8.10/lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb
i18n-1.8.10 lib/i18n/locale/tag/parents.rb
i18n-1.8.9 lib/i18n/locale/tag/parents.rb
i18n-1.8.8 lib/i18n/locale/tag/parents.rb
i18n-1.8.7 lib/i18n/locale/tag/parents.rb
i18n-1.8.6 lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb
i18n-1.8.5 lib/i18n/locale/tag/parents.rb
i18n-1.8.4 lib/i18n/locale/tag/parents.rb
i18n-1.8.3 lib/i18n/locale/tag/parents.rb