Sha256: a73e148eb06f2ae744b732681240ee84b47f7975d935f968ea9345e9da6dc6fe

Contents?: true

Size: 898 Bytes

Versions: 45

Compression:

Stored size: 898 Bytes

Contents

module ActiveTools
  module ActionPack
    module ActionController
      module PathHelper
        module ComplexHelpers
          def path?(controller, action = nil)
            controller?(controller) && action?(action)
          end

          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

          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
        end
      end
    end
  end

end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
active_tools-0.2.5 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.2.4 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.2.3 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.2.2 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.2.1 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.2.0 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.1.4 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.1.3 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.1.2 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.1.1 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.1.0 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.52 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.51 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.50 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.42 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.41 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.40 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.39 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.38 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb
active_tools-0.0.37 lib/active_tools/action_pack/action_controller/path_helper/complex_helpers.rb