Sha256: 46aa4b5079d0e3303991c8951e8eb6d6c79edebb0c2c9495a32a1401a877a560
Contents?: true
Size: 879 Bytes
Versions: 18
Compression:
Stored size: 879 Bytes
Contents
require "delegate" class Restly::Proxies::Base < SimpleDelegator delegate :is_a?, :kind_of?, to: :__getobj__ # Initialize the Proxy def initialize(receiver) # Dupe the Requester if receiver.class == Class @receiver = receiver.dup # Some Key Methods Added to the Duplicated Requester @receiver.class_eval %{ def inspect super.gsub(/^(#<)?#<[a-z0-9]+:([a-z0-9]+)(>)?/i, '#<#{receiver.name}:\\2') end def self.inspect super.gsub(/^#<[a-z0-9]+:.*/i, '#{receiver.name}') end def self.name "#{receiver.name}" end } else @receiver = receiver end # Initialize the Delegator super(@receiver) end alias_method :proxy_class, :class # Tell the Proxy its Class! def class @receiver.class end def proxied? true end end
Version data entries
18 entries across 18 versions & 1 rubygems