Sha256: 160e86514c307c7024c5a825eab1ea433d2b08b5843996b79fee2553e601ae6c

Contents?: true

Size: 514 Bytes

Versions: 8

Compression:

Stored size: 514 Bytes

Contents

# encoding: utf-8

module I18n
  module Locale
    module Tag
      module Parents
        def parent
          @parent ||= begin
            segs = to_a.compact
            segs.length > 1 ? self.class.tag(*segs[0..(segs.length-2)].join('-')) : nil
          end
        end
      
        def self_and_parents
          @self_and_parents ||= [self] + parents
        end
      
        def parents
          @parents ||= ([parent] + (parent ? parent.parents : [])).compact
        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/parents.rb
pepe-i18n-0.2.0 lib/i18n/locale/tag/parents.rb
thedarkone-i18n-0.2.0 lib/i18n/locale/tag/parents.rb
polish-0.0.5 lib/vendor/i18n/lib/i18n/locale/tag/parents.rb
polish-0.0.4 lib/vendor/i18n/lib/i18n/locale/tag/parents.rb
polish-0.0.3 lib/vendor/i18n/lib/i18n/locale/tag/parents.rb
polish-0.0.2 lib/vendor/i18n/lib/i18n/locale/tag/parents.rb
polish-0.0.1 lib/vendor/i18n/lib/i18n/locale/tag/parents.rb