On Nov 22, 6:52 am, Joshua Muheim <fo... / josh.ch> wrote:

> What's the equivalent to this...?

You have to use a predefined function if you want to pass a block,
e.g,

class A
  def new_method1(somep, opts={}, *args, &block)
    p opts
  end
  private
  def _foo(somep, opts={}, *args, &block)
    p opts
  end
  public
  define_method(:new_method2, instance_method(:_foo))
end

Also, you can't pass an optional argument to a block, you'd have to
write something like...

class A
  define_method(:new_method3) { |somep, *args|
    opts = {}
    if args.length > 0 && args[0].class == Hash
      opts = args[0]
    end
    p opts
  }
end

Regards,
Jordan