Module: ActionHandler::Equip

Defined in:
lib/action_handler/equip.rb

Overview

Equip implements most basic functionality of controller for handler.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(handler_class) ⇒ Object



30
31
32
33
34
# File 'lib/action_handler/equip.rb', line 30

def self.included(handler_class)
  ActionHandler::Config.set(handler_class, ActionHandler::Config.new)
  handler_class.extend ActionHandler::HandlerExtension
  handler_class.args ActionHandler::Args::Default.new
end

Instance Method Details

#redirect_to(*args) ⇒ Object



22
23
24
# File 'lib/action_handler/equip.rb', line 22

def redirect_to(*args)
  ActionHandler::Call.new(:redirect_to, args)
end

#render(props) ⇒ Object

Return the argument as is, because the actual rendering is done in a controller. This just makes returning values more easy. Without this:

{ status: :ok, json: user.to_json }

With this (no braces):

render status: :ok, json: user.to_json


18
19
20
# File 'lib/action_handler/equip.rb', line 18

def render(props)
  props
end

#urlsObject



26
27
28
# File 'lib/action_handler/equip.rb', line 26

def urls
  Rails.application.routes.url_helpers
end