Sha256: 205280c5d2edf5ec62fb42176e91ee00d9580d82576086b93e46cc3fedc2779a

Contents?: true

Size: 602 Bytes

Versions: 4

Compression:

Stored size: 602 Bytes

Contents

module Cistern::Request
  def self.service_request(service, klass)
    request = klass.request_name || Cistern::String.camelize(Cistern::String.demodulize(klass.name))

    service::Mock.module_eval <<-EOS, __FILE__, __LINE__
      def #{request}(*args)
        #{klass}.new(self).mock(*args)
      end
    EOS

    service::Real.module_eval <<-EOS, __FILE__, __LINE__
      def #{request}(*args)
        #{klass}.new(self).real(*args)
      end
    EOS
  end

  attr_reader :service

  def initialize(service)
    @service = service
  end

  module ClassMethods
    def request_name
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cistern-1.0.1.pre4 lib/cistern/request.rb
cistern-1.0.1.pre3 lib/cistern/request.rb
cistern-1.0.1.pre2 lib/cistern/request.rb
cistern-1.0.1.pre1 lib/cistern/request.rb