Class: Stratagem::Model::RouteContainer

Inherits:
ComponentContainer show all
Defined in:
lib/stratagem/model/application.rb

Instance Attribute Summary

Attributes inherited from ComponentContainer

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

Instance Method Summary collapse

Methods inherited from ComponentContainer

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

Constructor Details

This class inherits a constructor from Stratagem::Model::ComponentContainer

Instance Method Details

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



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/stratagem/model/application.rb', line 143

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

  unless path.nil?
    # path = path.gsub('http://www.example.com', '')
    route = self.find {|r| r.responds_to?(path, method) }
    puts "route: #{route.path}"
    route
  else
    nil
  end
end