Class: Rupta::UriExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/rupta/uri_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri_extract_processor) ⇒ UriExtractor

Returns a new instance of UriExtractor.



6
7
8
# File 'lib/rupta/uri_extractor.rb', line 6

def initialize(uri_extract_processor)
  @uri_extract_processor = uri_extract_processor
end

Instance Method Details

#extract(uri_templates, uri) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rupta/uri_extractor.rb', line 10

def extract(uri_templates, uri)
  uri_templates.each do |uri_template|
    uri_parameters = Addressable::Template.new(uri_template).extract(uri, @uri_extract_processor)
    return [uri_template, uri_parameters] if uri_parameters
  end
  nil
end