Module: ActiveTools::ActionPack::ActionController::PathHelper::ComplexHelpers

Included in:
HttpReferer
Defined in:
lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb

Instance Method Summary collapse

Instance Method Details

#action?(action) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
# File 'lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb', line 10

def action?(action)
  actions = case action
  when Array then action.map {|c| c.to_s}
  when String, Symbol then Array.wrap(action.to_s)
  else nil
  end
  actions.blank? ? true : current_action.in?(actions)
end

#controller?(controller) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
# File 'lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb', line 19

def controller?(controller)
  controllers = case controller
  when Array then controller.map {|c| c.to_s}
  when String, Symbol then Array.wrap(controller.to_s)
  else nil
  end
  controllers.blank? ? true : current_controller.in?(controllers)
end

#path?(controller, action = nil) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb', line 6

def path?(controller, action = nil)
  controller?(controller) && action?(action)
end