Doh!
def homer
Class.new do
def beer
puts 'mmmm beer'
end
def donuts
puts 'aaaauugggh dooooooooonuts!'
end
end
end
homer.new.beer
If you need to pass any variables, do it the old fashioned way.
The Tester methods are outside the scope of the anonymous class you have generated.
But what you can do is use instance variables to have a reference to tester.
class Scenario
def test3
Class.new do
attr_reader :environment
def initialize environment
@environment = environment
end
def run
environment.blah
end
end
end
end
scenario = Scenario.new
scenario.test3.new(scenario).run