Matthew K. Williams wrote: > As a followup, has_arguments? could be written as: > > def has_arguments?(&b) > vars = eval("local_variables",b.binding) > return false if vars.length == 0 > vars.each do |v| > return false if eval("#{v}.nil?",b) > end > return true > end > end > > > then you'd call it like: > > if has_arguments? {} #note the empty block > something > end > > > Matt Using #local_variables won't work for this, will it? def has_arguments?(&b) vars = eval("local_variables",b.binding) return false if vars.length == 0 vars.each do |v| return false if eval("#{v}.nil?",b) end return true end def foo(*a) if has_arguments? {} #note the empty block p a else puts "no args" end x=3 # <-- N.B. end foo() foo(1,2,3) __END__ Output: no args no args -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407