On Aug 30, 12:58 pm, bwv549 <jtpri... / gmail.com> wrote:
> # from ri class_eval:
> class Thing
> end
> a = %q{def hello() "Hello there!" end}
> Thing.module_eval(a)
> puts Thing.new.hello()
> Thing.module_eval("invalid code", "dummy", 123)

And no need to use strings:
  module Joi
    def happy?; true; end
  end

  class Foo; end

  f1 = Foo.new
  f2 = Foo.new

  f2.class.class_eval{ include Joi }
  p f1.happy?
  #=> true