Module: Crabfarm::Factories::Context

Includes:
Decorable
Defined in:
lib/crabfarm/factories/context.rb

Class Method Summary collapse

Methods included from Decorable

included

Class Method Details

.default_build(_memento) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/crabfarm/factories/context.rb', line 8

def self.default_build(_memento)
  if _memento.nil?
    Crabfarm::Context.new
  else
    load_crabtrap_context _memento
  end
end

.load_crabtrap_context(_memento) ⇒ Object



16
17
18
19
20
21
# File 'lib/crabfarm/factories/context.rb', line 16

def self.load_crabtrap_context(_memento)
  require 'crabfarm/crabtrap_context'
  m_path = Utils::Resolve.memento_path _memento
  raise ResourceNotFoundError.new "Could not find memento '#{_memento}'" unless File.exists? m_path
  Crabfarm::CrabtrapContext.new :replay, m_path
end