Sha256: 44ffdf006493945a3cdefb9c627b510ae518108d578a78e4e6b4af1948b4d2c3

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

require 'delegate'

module Restspec
  module Stores
    class EndpointStoreDelegator < SimpleDelegator
      def store(endpoint)
        self[endpoint.full_name] = endpoint
      end

      def get(endpoint_name)
        self[endpoint_name]
      end

      def get_by_schema_and_name(schema_name, endpoint_name)
        values.find do |endpoint|
          endpoint.schema_name == schema_name && endpoint.name == endpoint_name
        end
      end
    end

    EndpointStore = EndpointStoreDelegator.new(Hash.new)
  end

  EndpointStore = Stores::EndpointStore
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restspec-0.0.4 lib/restspec/stores/endpoint_store.rb
restspec-0.0.3 lib/restspec/stores/endpoint_store.rb
restspec-0.0.2 lib/restspec/stores/endpoint_store.rb
restspec-0.0.1 lib/restspec/stores/endpoint_store.rb