Sha256: 7f1a2ec2ab5cd5a614e3236071ac20438269ca1d245e8dbaf380b0abf9d5c435
Contents?: true
Size: 687 Bytes
Versions: 12
Compression:
Stored size: 687 Bytes
Contents
module Resourcelogic class ResponseCollector attr_reader :responses delegate :clear, :to => :responses def initialize @responses = [] end def method_missing(method_name, &block) @responses.delete self[method_name] value = [method_name, block || nil] if method_name == :html @responses.unshift(value) else @responses << value end end def [](symbol) @responses.find { |method, block| method == symbol } end def dup returning ResponseCollector.new do |duplicate| duplicate.instance_variable_set(:@responses, responses.dup) end end end end
Version data entries
12 entries across 12 versions & 2 rubygems