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.8.12 lib/para/routing/component_name_constraint.rb
para-0.8.11 lib/para/routing/component_name_constraint.rb
para-0.8.10 lib/para/routing/component_name_constraint.rb
para-0.8.9 lib/para/routing/component_name_constraint.rb
para-0.8.8 lib/para/routing/component_name_constraint.rb
para-0.8.7 lib/para/routing/component_name_constraint.rb
para-0.8.5 lib/para/routing/component_name_constraint.rb
para-0.8.3.3 lib/para/routing/component_name_constraint.rb
para-0.8.3.2 lib/para/routing/component_name_constraint.rb
para-0.8.3.1 lib/para/routing/component_name_constraint.rb
para-0.8.3 lib/para/routing/component_name_constraint.rb
para-0.8.2.3 lib/para/routing/component_name_constraint.rb
para-0.8.2.2 lib/para/routing/component_name_constraint.rb
para-0.8.2.1 lib/para/routing/component_name_constraint.rb
para-0.8.2 lib/para/routing/component_name_constraint.rb
para-0.8.1 lib/para/routing/component_name_constraint.rb
para-0.8.0 lib/para/routing/component_name_constraint.rb
para-0.7.4.p1 lib/para/routing/component_name_constraint.rb
para-0.7.4 lib/para/routing/component_name_constraint.rb
para-0.7.3.p6 lib/para/routing/component_name_constraint.rb