module URITemplate::RFC6570::Expression::ClassMethods

Public Instance Methods

generate_hash_extractor(max_length) click to toggle source
# File lib/uri_template/rfc6570/expression.rb, line 168
def generate_hash_extractor(max_length)
  source = regex_builder
  source.push('\\A')
  source.escaped_separator
  source.capture do
    source.character_class('+').reluctant
  end
  source.group do
    source.escaped_pair_connector
    source.capture do
      source.character_class(max_length,0).reluctant
    end
  end.length('?')
  source.lookahead do
    source.push '\\z'
    source.push '|'
    source.escaped_separator
    source.push '[^'
      source.escaped_separator
    source.push ']'
  end
  return Regexp.new( source.join , Utils::KCODE_UTF8)
end
hash_extractor(max_length) click to toggle source
# File lib/uri_template/rfc6570/expression.rb, line 164
def hash_extractor(max_length)
  return hash_extractors[max_length]
end
hash_extractors() click to toggle source
# File lib/uri_template/rfc6570/expression.rb, line 160
def hash_extractors
  @hash_extractors ||= Hash.new{|hsh, key| hsh[key] = generate_hash_extractor(key) }
end
regex_builder() click to toggle source
# File lib/uri_template/rfc6570/expression.rb, line 192
def regex_builder
  RegexBuilder.new(self)
end