From: Robert Klemme Date: 2012-10-24T22:41:06+09:00 Subject: Re: Calling a method foo() or an object foo.method_call_here - both On Wed, Oct 24, 2012 at 3:20 PM, Marc Heiler wrote: > Your example unfortunately requires the leading name > of the object. This is not what I want, because it > would require additional typing effort. But you cannot use "foo" to denote the object and invoke the method at the same time. This is simply not possible. How about defining a function class: class Function attr_accessor :default def call(x = default, *rest) printf "x=%p rest=%p\n", x, rest end end # or even f = Class.new do attr_accessor :default def call(x=default, *rest) printf "x=%p rest=%p\n", x, rest end end.new f = Function.new f.call f.default = 123 f.call Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/