Class: Rack::Rewrite::Action::Do

Inherits:
Rack::Rewrite::Action show all
Defined in:
lib/rack_rewrite/actions.rb

Instance Method Summary collapse

Methods inherited from Rack::Rewrite::Action

#query_string=, #respond_to?, #scheme=, #setup

Constructor Details

#initialize(caller, action) ⇒ Do

Returns a new instance of Do.



66
67
68
69
# File 'lib/rack_rewrite/actions.rb', line 66

def initialize(caller, action)
  @caller = caller
  @action = action
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/rack_rewrite/actions.rb', line 71

def method_missing(method, *args, &block)
  if respond_to?(method)
    super
  else
    @caller.send(method, *args, &block)
  end
end

Instance Method Details

#call(env) ⇒ Object



79
80
81
82
83
# File 'lib/rack_rewrite/actions.rb', line 79

def call(env)
  setup(env)
  instance_eval(&@action)
  env
end