class I18n::Locale::Tag::Rfc4646

Public Class Methods

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

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

Public Instance Methods

# File lib/i18n/locale/tag/rfc4646.rb, line 46
def to_a
  members.collect { |attr| self.send(attr) }
end
# File lib/i18n/locale/tag/rfc4646.rb, line 42
def to_s
  @tag ||= to_a.compact.join("-")
end
# File lib/i18n/locale/tag/rfc4646.rb, line 38
def to_sym
  to_s.to_sym
end