Method: Such::Thing.into

Defined in:
lib/such/thing.rb

.into(obj, container = nil, mthd = nil, *args) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/such/thing.rb', line 69

def self.into(obj, container=nil, mthd=nil, *args)
  if container
    if mthd
      unless container.respond_to?(mthd)
        raise "Need container & method. Got #{container.class}##{mthd}(#{obj.class}...)"
      end
    else
      mthd=Thing.which_method(container)
    end
    Thing.trace_method(container, mthd, [obj.class,*args]) if $VERBOSE
    container.public_send(mthd, obj, *args)
  else
    warn "Warning: Container for #{self.class} not given."
  end
end