class I18n::Locale::Tag::Rfc4646 - i18n-0.6.11 Documentation

# class I18n::Locale::Tag::Rfc4646

### Public Instance Methods

parser() click to toggle source

    # File lib/i18n/locale/tag/rfc4646.rb, line 23
    def parser
      @@parser ||= Rfc4646::Parser
    end

parser=(parser) click to toggle source

    # File lib/i18n/locale/tag/rfc4646.rb, line 27
    def parser=(parser)
      @@parser = parser
    end

tag(tag) click to toggle source

Parses the given tag and returns a Tag instance if it is valid. Returns false if the given tag is not valid according to RFC 4646.

    # File lib/i18n/locale/tag/rfc4646.rb, line 18
    def tag(tag)
      matches = parser.match(tag)
      new(*matches) if matches
    end

to_a() click to toggle source

    # File lib/i18n/locale/tag/rfc4646.rb, line 46
    def to_a
      members.collect { |attr| self.send(attr) }
    end

to_s() click to toggle source

    # File lib/i18n/locale/tag/rfc4646.rb, line 42
    def to_s
      @tag ||= to_a.compact.join("-")
    end

to_sym() click to toggle source

    # File lib/i18n/locale/tag/rfc4646.rb, line 38
    def to_sym
      to_s.to_sym
    end