Class: ActionController::Routing::Optimisation::Optimiser
- Defined in:
- lib/action_controller/routing/optimisations.rb
Direct Known Subclasses
Constant Summary collapse
- GLOBAL_GUARD_CONDITIONS =
[ "(!defined?(default_url_options) || default_url_options.blank?)", "(!defined?(controller.default_url_options) || controller.default_url_options.blank?)", "defined?(request)", "request" ]
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Instance Method Summary collapse
-
#applicable? ⇒ Boolean
Temporarily disabled
:url
optimisation pending proper solution to Issues around request.host etc. - #generation_code ⇒ Object
- #guard_conditions ⇒ Object
-
#initialize(route, kind) ⇒ Optimiser
constructor
A new instance of Optimiser.
- #source_code ⇒ Object
Constructor Details
#initialize(route, kind) ⇒ Optimiser
Returns a new instance of Optimiser.
30 31 32 33 |
# File 'lib/action_controller/routing/optimisations.rb', line 30 def initialize(route, kind) @route = route @kind = kind end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
22 23 24 |
# File 'lib/action_controller/routing/optimisations.rb', line 22 def kind @kind end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
22 23 24 |
# File 'lib/action_controller/routing/optimisations.rb', line 22 def route @route end |
Instance Method Details
#applicable? ⇒ Boolean
Temporarily disabled :url
optimisation pending proper solution to Issues around request.host etc.
54 55 56 |
# File 'lib/action_controller/routing/optimisations.rb', line 54 def applicable? true end |
#generation_code ⇒ Object
39 40 41 |
# File 'lib/action_controller/routing/optimisations.rb', line 39 def generation_code 'nil' end |
#guard_conditions ⇒ Object
35 36 37 |
# File 'lib/action_controller/routing/optimisations.rb', line 35 def guard_conditions ["false"] end |
#source_code ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/action_controller/routing/optimisations.rb', line 43 def source_code if applicable? guard_condition = (GLOBAL_GUARD_CONDITIONS + guard_conditions).join(" && ") "return #{generation_code} if #{guard_condition}\n" else "\n" end end |