lib/accept_headers/language.rb in accept_headers-0.0.7 vs lib/accept_headers/language.rb in accept_headers-0.0.8

- old
+ new

@@ -5,12 +5,10 @@ include Comparable include Acceptable attr_reader :primary_tag, :subtag - LANGUAGE_TAG_PATTERN = /^\s*(?<primary_tag>[\w]{1,8}|\*)(?:\s*\-\s*(?<subtag>[\w]{1,8}|\*))?\s*$/ - def initialize(primary_tag = '*', subtag = nil, q: 1.0) self.primary_tag = primary_tag self.subtag = subtag self.q = q end @@ -61,10 +59,10 @@ "#{primary_tag}-#{subtag}" end end def match(language_tag_string) - match_data = LANGUAGE_TAG_PATTERN.match(language_tag_string) + match_data = Negotiator::LANGUAGE_TAG_PATTERN.match(language_tag_string) if !match_data false elsif primary_tag == match_data[:primary_tag] && subtag == match_data[:subtag] true elsif primary_tag == match_data[:primary_tag] && subtag == '*'