Class: Kafo::MigrationContext

Inherits:
BaseContext show all
Defined in:
lib/kafo/migration_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseContext

#facts

Constructor Details

#initialize(scenario, answers) ⇒ MigrationContext

Returns a new instance of MigrationContext.



14
15
16
17
# File 'lib/kafo/migration_context.rb', line 14

def initialize(scenario, answers)
  @scenario = scenario
  @answers = answers
end

Instance Attribute Details

#answersObject

Returns the value of attribute answers.



6
7
8
# File 'lib/kafo/migration_context.rb', line 6

def answers
  @answers
end

#scenarioObject

Returns the value of attribute scenario.



6
7
8
# File 'lib/kafo/migration_context.rb', line 6

def scenario
  @scenario
end

Class Method Details

.execute(scenario, answers, &migration) ⇒ Object



8
9
10
11
12
# File 'lib/kafo/migration_context.rb', line 8

def self.execute(scenario, answers, &migration)
  context = new(scenario, answers)
  context.instance_eval(&migration)
  return context.scenario, context.answers
end

Instance Method Details

#loggerObject



19
20
21
# File 'lib/kafo/migration_context.rb', line 19

def logger
  KafoConfigure.logger
end