Class: Cucumber::Glue::WorldFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/glue/world_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(proc) ⇒ WorldFactory

Returns a new instance of WorldFactory



4
5
6
# File 'lib/cucumber/glue/world_factory.rb', line 4

def initialize(proc)
  @proc = proc || -> { Object.new }
end

Instance Method Details

#create_worldObject



8
9
10
# File 'lib/cucumber/glue/world_factory.rb', line 8

def create_world
  @proc.call || raise_nil_world
end

#raise_nil_worldObject



12
13
14
15
16
17
18
# File 'lib/cucumber/glue/world_factory.rb', line 12

def raise_nil_world
  raise NilWorld.new
rescue NilWorld => e
  e.backtrace.clear
  e.backtrace.push(Glue.backtrace_line(@proc, 'World'))
  raise e
end