lib/quickbooks/ruby_magic.rb
# This allows one to effectively 'proxy' specific methods to be called on the return value of one of its methods.
# For example, obj.length could be delegated to do the same thing as obj.full_text.length
This allows one to effectively 'proxy' specific methods to be called on the return value of one of its methods.
This allows one to effectively ' proxy ' specific methods to be called on the return value of one of its methods .
def delegate_methods(hsh)
    raise ArgumentError, "delegate_methods should be called like: delegate_methods [:method1, :method2] => :delegated_to_method" unless hsh.keys.first.is_a?(Array)
    methods = hsh.keys.first
    delegate_to = hsh[methods]
    methods.each do |method|
      self.send(:eval, <<-ddddddd
        def #{method}(*args, &block)
          block_given? ? self.#{delegate_to}.#{method}(*args, &block) : self.#{delegate_to}.#{method}(*args)
        end
      ddddddd
      )
    end
  end
def delegate_methods ( hsh ) raise ArgumentError , "delegate_methods should be called like: delegate_methods [:method1, :method2] => :delegated_to_method" unless hsh . keys . first . is_a? ( Array ) methods = hsh . keys . first delegate_to = hsh [ methods ] methods . each do | method | self . send ( :eval , <<-ddddddd 
        def  #{ method } (*args, &block)
          block_given? ? self. #{ delegate_to } . #{ method } (*args, &block) : self. #{ delegate_to } . #{ method } (*args)
        end
       ddddddd ) end end
This allows one to effectively 'proxy' specific methods to be called on the return value of one of its methods.
This allows one to effectively ' proxy ' specific methods to be called on the return value of one of its methods .
hsh
<not_specific>