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.



6
7
8
# File 'lib/cucumber/glue/world_factory.rb', line 6

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

Instance Method Details

#create_worldObject



10
11
12
# File 'lib/cucumber/glue/world_factory.rb', line 10

def create_world
  @proc.call || raise_nil_world
end

#raise_nil_worldObject



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

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