Sha256: 63159088b041fd8099e492ab144da3fef5a1ddc65d64e81a277f454d5c489242

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

module Apitizer
  module Routing
    module Node
      class Operation < Base
        def initialize(name, action:, on:)
          @name = name
          @action = action
          @on = on
        end

        def recognize?(steps)
          @name == steps.first || @name.to_s =~ /^:/
        end

        def permit?(action, on:)
          @action == action && @on == on
        end

        def on?(on)
          @on == on
        end

        private

        def walk(steps, path)
          path.advance(steps.shift, node: self, on: @on)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apitizer-0.0.2 lib/apitizer/routing/node/operation.rb