class GrpcMock::RequestPattern

Public Class Methods

new(path) click to toggle source

@param path [String]

# File lib/grpc_mock/request_pattern.rb, line 6
def initialize(path)
  @path = path
  @block = nil
  @request = nil
end

Public Instance Methods

match?(path, request) click to toggle source
# File lib/grpc_mock/request_pattern.rb, line 21
def match?(path, request)
  @path == path && (@request.nil? || @request == request) && (@block.nil? || @block.call(path))
end
with(request = nil, &block) click to toggle source
# File lib/grpc_mock/request_pattern.rb, line 12
def with(request = nil, &block)
  if request.nil? && !block_given?
    raise ArgumentError, '#with method invoked with no arguments. Either options request or block must be specified.'
  end

  @request = request
  @block = block
end