Class: Orchestra::DSL::Operations::Context

Inherits:
BasicObject
Defined in:
lib/orchestra/dsl/operations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Context

Returns a new instance of Context.



70
71
72
# File 'lib/orchestra/dsl/operations.rb', line 70

def initialize builder
  @builder = builder
end

Instance Attribute Details

#stepsObject (readonly)

Returns the value of attribute steps.



68
69
70
# File 'lib/orchestra/dsl/operations.rb', line 68

def steps
  @steps
end

Class Method Details

.evaluate(builder, &block) ⇒ Object



63
64
65
66
# File 'lib/orchestra/dsl/operations.rb', line 63

def self.evaluate builder, &block
  context = new builder
  context.instance_eval &block
end

Instance Method Details

#finally(name = :__finally__, &block) ⇒ Object



91
92
93
94
95
# File 'lib/orchestra/dsl/operations.rb', line 91

def finally name = :__finally__, &block
  @builder.add_step name, &block
  @builder.command = true
  self.result = name
end

#result(*args, &block) ⇒ Object



84
85
86
87
88
89
# File 'lib/orchestra/dsl/operations.rb', line 84

def result *args, &block
  args << :result if args.empty?
  step = @builder.add_step *args, &block
  name ||= step.provisions.fetch 0
  self.result = name
end

#result=(result) ⇒ Object



79
80
81
82
# File 'lib/orchestra/dsl/operations.rb', line 79

def result= result
  @builder.result = result
  nil
end

#step(*args, &block) ⇒ Object



74
75
76
77
# File 'lib/orchestra/dsl/operations.rb', line 74

def step *args, &block
  @builder.add_step *args, &block
  nil
end