[Cucumber] attribute readers in World?


#1

Hi,

#env.rb
class ProjectWorld
include Spec::Matchers

def browser
@browser ||= Browser.new
end
end

World do
ProjectWorld.new
end

Instead of using explicit getters here, can I not use attribute readers?

Aidy


#2

On Tue, Apr 14, 2009 at 2:19 PM, aidy lewis
removed_email_address@domain.invalidwrote:

World do
ProjectWorld.new
end

Instead of using explicit getters here, can I not use attribute readers?

You can, as long as you initialize @browser in initialize. It would be
almost the same (eager instead of lazy instantiation)

Aslak