Class: Stratagem::Model::Containers::Route

Inherits:
Base show all
Defined in:
lib/stratagem/model/containers/route.rb

Instance Attribute Summary

Attributes inherited from Base

#components, #errors, #invalid, #missing, #parse_trees

Instance Method Summary collapse

Methods inherited from Base

#-, #<<, #clear, #each, #export, #find, #initialize, #map, #size

Constructor Details

This class inherits a constructor from Stratagem::Model::Containers::Base

Instance Method Details

#recognize(page, method = :get) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stratagem/model/containers/route.rb', line 3

def recognize(page, method = :get)
  path = nil
  if (page.kind_of?(Stratagem::Crawler::SiteModel::Page))
    method = page.method
    path = page.path
  else
    path = page
  end

  unless path.nil?
    self.find {|r| r.responds_to?(path, method) }
  else
    nil
  end
end