class ProtoPharm::RequestPattern
Attributes
block[R]
path[R]
request[R]
Public Class Methods
new(path)
click to toggle source
@param path [String]
# File lib/proto_pharm/request_pattern.rb, line 8 def initialize(path) @path = path @block = nil @request = nil end
Public Instance Methods
match?(match_path, match_request)
click to toggle source
# File lib/proto_pharm/request_pattern.rb, line 23 def match?(match_path, match_request) path == match_path && (request.nil? || request == match_request) && (block.nil? || block.call(match_path)) end
with(request = nil, &block)
click to toggle source
# File lib/proto_pharm/request_pattern.rb, line 14 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