class AndSon::StoredResponses

Public Class Methods

new() click to toggle source
# File lib/and-son/stored_responses.rb, line 8
def initialize
  @hash = Hash.new{ |h, k| h[k] = Stub.new }
end

Public Instance Methods

add(name, &block) click to toggle source
# File lib/and-son/stored_responses.rb, line 12
def add(name, &block)
  @hash[name].tap{ |s| s.set_default_proc(&block) }
end
get(name, params) click to toggle source
# File lib/and-son/stored_responses.rb, line 16
def get(name, params)
  response = @hash[name].call(params)
  AndSon::Response.new(response)
end
remove(name) click to toggle source
# File lib/and-son/stored_responses.rb, line 21
def remove(name)
  @hash.delete(name)
end
remove_all() click to toggle source
# File lib/and-son/stored_responses.rb, line 25
def remove_all
  @hash.clear
end