Okay, I missed the deeper meaning of eval in your example.

    eval("lambda {#{IO.read(file)} }")

Maybe:

    @task = if file
                ruby = file.read file
                lambda { eval ruby }
            else
                block
            end

> I'm not necessarily looking for the simplest solution, I'm looking for
> the best solution.  Both of the examples I posted have the same results,
> it's just how they are implemented.

The second one creates the method in the class though which most
likely
isn't what you want.

    irb(main):032:0> j = JobB.new('test.rb')
    => #<JobB:0x7fec2adc>
    irb(main):034:0> JobB.instance_method(:do)
    => #<UnboundMethod: JobB#do>

If you want to minimize the context, create a new method that gets
nothing but the file name as argument and returns the block for the
file. I think that's what's meant in the blog post.