[Cucumber] attribute readers in World?

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

On Tue, Apr 14, 2009 at 2:19 PM, aidy lewis
[email protected]wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs