lib/httpx/chainable.rb in httpx-0.10.0 vs lib/httpx/chainable.rb in httpx-0.10.1
- old
+ new
@@ -40,16 +40,19 @@
klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
klass.plugin(*args, **opts, &blk).new
end
# deprecated
+ # :nocov:
def plugins(*args, **opts)
+ warn ":#{__method__} is deprecated, use :plugin instead"
klass = is_a?(Session) ? self.class : Session
klass = Class.new(klass)
klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
klass.plugins(*args, **opts).new
end
+ # :nocov:
def with(options, &blk)
branch(default_options.merge(options), &blk)
end
@@ -64,15 +67,13 @@
Session.new(options, &blk)
end
def method_missing(meth, *args, **options)
- if meth =~ /\Awith_(.+)/
- option = Regexp.last_match(1).to_sym
- with(option => (args.first || options))
- else
- super
- end
+ return super unless meth =~ /\Awith_(.+)/
+
+ option = Regexp.last_match(1).to_sym
+ with(option => (args.first || options))
end
def respond_to_missing?(meth, *args)
default_options.respond_to?(meth, *args) || super
end