Sha256: 3108a2c4ad681050b16720d60c1eb9dbf01a1288364352f13bfb61cb3fb5c942

Contents?: true

Size: 727 Bytes

Versions: 8

Compression:

Stored size: 727 Bytes

Contents

# encoding: utf-8

require 'i18n/locale/tag/parents'

# Simple Locale tag implementation that computes subtags by simply splitting
# the locale tag at '-' occurences.

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 { |subtag| subtag.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

8 entries across 8 versions & 4 rubygems

Version Path
lawrencepit-i18n-0.2.0.1 lib/i18n/locale/tag/simple.rb
pepe-i18n-0.2.0 lib/i18n/locale/tag/simple.rb
thedarkone-i18n-0.2.0 lib/i18n/locale/tag/simple.rb
polish-0.0.5 lib/vendor/i18n/lib/i18n/locale/tag/simple.rb
polish-0.0.4 lib/vendor/i18n/lib/i18n/locale/tag/simple.rb
polish-0.0.3 lib/vendor/i18n/lib/i18n/locale/tag/simple.rb
polish-0.0.2 lib/vendor/i18n/lib/i18n/locale/tag/simple.rb
polish-0.0.1 lib/vendor/i18n/lib/i18n/locale/tag/simple.rb