Class: Lego::Controller::ActionContext

Inherits:
Object
  • Object
show all
Defined in:
lib/lego/controller/action_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeActionContext

Returns a new instance of ActionContext.



8
9
10
# File 'lib/lego/controller/action_context.rb', line 8

def initialize
  setup_defaults
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



6
7
8
# File 'lib/lego/controller/action_context.rb', line 6

def env
  @env
end

#match_dataObject

Returns the value of attribute match_data.



6
7
8
# File 'lib/lego/controller/action_context.rb', line 6

def match_data
  @match_data
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/lego/controller/action_context.rb', line 6

def response
  @response
end

#routeObject

Returns the value of attribute route.



6
7
8
# File 'lib/lego/controller/action_context.rb', line 6

def route
  @route
end

Instance Method Details

#options(key) ⇒ Object



12
13
14
# File 'lib/lego/controller/action_context.rb', line 12

def options(key)
  "#{self.class::ApplicationClass.current_config.options(key)}"
end

#run(match_data) ⇒ Object



16
17
18
19
20
21
# File 'lib/lego/controller/action_context.rb', line 16

def run(match_data)
  @route, @env, @match_data = match_data
  setup_instance_vars_from_route
  evaluate_action
  [@response[:code], @response[:headers], @response[:body]]
end