Sha256: b78d8db6f358045154f12372b0d13e51d06553306fea4f427780c5ae24f79556

Contents?: true

Size: 657 Bytes

Versions: 30

Compression:

Stored size: 657 Bytes

Contents

# Simple Locale tag implementation that computes subtags by simply splitting
# the locale tag at '-' occurrences.
module I18n
  module Locale
    module Tag
      class Simple
        class << self
          def tag(tag)
            new(tag)
          end
        end

        include Parents

        attr_reader :tag

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

        def subtags
          @subtags = tag.to_s.split('-').map!(&:to_s)
        end

        def to_sym
          tag
        end

        def to_s
          tag.to_s
        end

        def to_a
          subtags
        end
      end
    end
  end
end

Version data entries

30 entries across 28 versions & 11 rubygems

Version Path
i18n-1.14.6 lib/i18n/locale/tag/simple.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.5/lib/i18n/locale/tag/simple.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/locale/tag/simple.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/locale/tag/simple.rb
i18n-1.14.5 lib/i18n/locale/tag/simple.rb
i18n-1.14.4 lib/i18n/locale/tag/simple.rb
i18n-1.14.3 lib/i18n/locale/tag/simple.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/locale/tag/simple.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/locale/tag/simple.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/locale/tag/simple.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/locale/tag/simple.rb