Class: Fluoride::Analyzer::Patterner
- Inherits:
-
Object
- Object
- Fluoride::Analyzer::Patterner
- Defined in:
- lib/fluoride-analyzer/patterner.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#rails_routes ⇒ Object
readonly
Returns the value of attribute rails_routes.
Class Method Summary collapse
Instance Method Summary collapse
- #base_env ⇒ Object
- #build_request(result_env) ⇒ Object
-
#initialize(rails_routes) ⇒ Patterner
constructor
A new instance of Patterner.
- #route_map ⇒ Object
- #route_set ⇒ Object
Constructor Details
#initialize(rails_routes) ⇒ Patterner
Returns a new instance of Patterner.
29 30 31 |
# File 'lib/fluoride-analyzer/patterner.rb', line 29 def initialize(rails_routes) @rails_routes = rails_routes end |
Instance Attribute Details
#rails_routes ⇒ Object (readonly)
Returns the value of attribute rails_routes.
32 33 34 |
# File 'lib/fluoride-analyzer/patterner.rb', line 32 def rails_routes @rails_routes end |
Class Method Details
Instance Method Details
#base_env ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fluoride-analyzer/patterner.rb', line 13 def base_env @base_env ||= { "HTTP_REFERER" => '', "HTTP_COOKIE" => '', "HTTP_AUTHORIZATION" => '', "REQUEST_METHOD" => "GET", 'HTTP_HOST' => '', 'SERVER_NAME' => '', 'SERVER_ADDR' => '', 'SERVER_PORT' => '80', "SCRIPT_NAME" => '', "QUERY_STRING" => '', 'rack.input' => '' #body } end |
#build_request(result_env) ⇒ Object
34 35 36 |
# File 'lib/fluoride-analyzer/patterner.rb', line 34 def build_request(result_env) ActionDispatch::Request.new(base_env.merge(request_env)) end |
#route_map ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/fluoride-analyzer/patterner.rb', line 38 def route_map @route_map ||= begin ad_routes_array = rails_routes.routes rack_routes_array = rails_routes.set.instance_eval{ @routes } Hash[ rack_routes_array.zip(ad_routes_array) ] end end |
#route_set ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/fluoride-analyzer/patterner.rb', line 47 def route_set @route_set ||= begin set = rails_routes.set set end end |