Class: ActionController::Routing::Optimisation::Optimiser

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/routing/optimisations.rb

Direct Known Subclasses

PositionalArguments

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route, kind) ⇒ Optimiser

Returns a new instance of Optimiser.



23
24
25
26
# File 'lib/action_controller/routing/optimisations.rb', line 23

def initialize(route, kind)
  @route = route
  @kind  = kind
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



22
23
24
# File 'lib/action_controller/routing/optimisations.rb', line 22

def kind
  @kind
end

#routeObject (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.

Returns:

  • (Boolean)


46
47
48
# File 'lib/action_controller/routing/optimisations.rb', line 46

def applicable?
  true
end

#generation_codeObject



32
33
34
# File 'lib/action_controller/routing/optimisations.rb', line 32

def generation_code
  'nil'
end

#guard_conditionObject



28
29
30
# File 'lib/action_controller/routing/optimisations.rb', line 28

def guard_condition
  'false'
end

#source_codeObject



36
37
38
39
40
41
42
# File 'lib/action_controller/routing/optimisations.rb', line 36

def source_code
  if applicable?
    "return #{generation_code} if #{guard_condition}\n"
  else
    "\n"
  end
end