class Typhoid::TyphoeusDecorator
Attributes
source[R]
Public Class Methods
decorate(typhoeus_klass)
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 3 def self.decorate(typhoeus_klass) @source_klass = typhoeus_klass end
inspect()
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 33 def self.inspect "#{self.name}Decorator(#{source_klass.name})" end
method_missing(method_name, *args, &block)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 21 def self.method_missing(method_name, *args, &block) if source_klass.respond_to? method_name source_klass.public_send method_name, *args, &block else super end end
new(*args, &block)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 11 def self.new(*args, &block) if args.first.is_a?(self) args.first elsif args.first.is_a?(source_klass) super else super(source_klass.new(*args, &block)) end end
new(source)
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 39 def initialize(source) @source = source end
respond_to?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 29 def self.respond_to?(method_name, include_private = false) source_klass.respond_to?(method_name) || super end
source_klass()
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 7 def self.source_klass @source_klass end
Public Instance Methods
==(other)
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 43 def ==(other) other == source end
compat(method_names, *args, &block)
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 56 def compat(method_names, *args, &block) method_to_call = Array(method_names).find { |method_name| respond_to? method_name } if method_to_call source.public_send method_to_call, *args, &block else raise TyphoeusCompatabilityError, "Typhoeus API has changed, we don't know how to get response. We know about [:handled_response, :response]" end end
inspect()
click to toggle source
# File lib/typhoid/typhoeus_decorator.rb, line 66 def inspect "#<#{self.class.name} source: (#{source.inspect})>" end
instance_of?(klass)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 52 def instance_of?(klass) super || source.instance_of?(klass) end
kind_of?(klass)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 47 def kind_of?(klass) super || source.kind_of?(klass) end
Also aliased as: is_a?
method_missing(method_name, *args, &block)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 70 def method_missing(method_name, *args, &block) if source.respond_to? method_name source.public_send method_name, *args, &block else super end end
respond_to?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/typhoid/typhoeus_decorator.rb, line 78 def respond_to?(method_name, include_private = false) source.respond_to?(method_name) || super end