Sha256: 0976175267e025440004bc90d2e077cd1b0d43713845a69b1eaf768b7c836483

Contents?: true

Size: 602 Bytes

Versions: 52

Compression:

Stored size: 602 Bytes

Contents

# Allows constraining routing to components that explicitly declares to use a
# given component to manage their resources.
#
# It's mainly used to allow users to override the default component for the
# resources of a given Crud or Form components without having to
# subclass the component and declare all the routes again
#
module Para
  module Routing
    class ComponentNameConstraint
      attr_reader :component

      def initialize(component)
        @component = component.to_s
      end

      def matches?(request)
        component == request.params[:component]
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
para-0.12.4 lib/para/routing/component_name_constraint.rb
para-0.12.3 lib/para/routing/component_name_constraint.rb
para-0.12.2 lib/para/routing/component_name_constraint.rb
para-0.12.1 lib/para/routing/component_name_constraint.rb
para-0.12.0 lib/para/routing/component_name_constraint.rb
para-0.11.4 lib/para/routing/component_name_constraint.rb
para-0.11.3 lib/para/routing/component_name_constraint.rb
para-0.11.2 lib/para/routing/component_name_constraint.rb
para-0.11.1 lib/para/routing/component_name_constraint.rb
para-0.11.0 lib/para/routing/component_name_constraint.rb
para-0.10.0 lib/para/routing/component_name_constraint.rb
para-0.9.4 lib/para/routing/component_name_constraint.rb
para-0.9.3.3 lib/para/routing/component_name_constraint.rb
para-0.9.3.2 lib/para/routing/component_name_constraint.rb
para-0.9.3.1 lib/para/routing/component_name_constraint.rb
para-0.9.2 lib/para/routing/component_name_constraint.rb
para-0.9.0 lib/para/routing/component_name_constraint.rb
para-0.8.15 lib/para/routing/component_name_constraint.rb
para-0.8.14 lib/para/routing/component_name_constraint.rb
para-0.8.13 lib/para/routing/component_name_constraint.rb