lib/peaty/proxy.rb in peaty-0.3.0 vs lib/peaty/proxy.rb in peaty-0.4.0
- old
+ new
@@ -2,11 +2,11 @@
class Proxy
attr_accessor :target, :connection, :options
def initialize(target, connection, options = {})
- @target, @connection, @options = target, connection, options
+ @target, @connection, @options = target, connection, options.with_indifferent_access
end
def method_missing(method, *args)
return @target.method(method).unbind.bind(self).call(*args) if @target.class.respond_to?(method)
options = args.extract_options!
@@ -21,9 +21,13 @@
end
@options[:rest] = Array.wrap(@options.delete(:rest)).concat(args)
self
+ end
+
+ def self.build(attrs = {})
+ @target.build(@options.merge(attrs.with_indifferent_access))
end
end
end