Class: Faith::DSL::ChildBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/faith/dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ ChildBuilder

Returns a new instance of ChildBuilder.



18
19
20
# File 'lib/faith/dsl.rb', line 18

def initialize(parent)
  @parent = parent
end

Instance Method Details

#group(name, &block) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/faith/dsl.rb', line 34

def group(name, &block)
  DSL.validate_name!(name)

  group = Group.new(name, @parent, [])
  @parent.children << group

  Docile.dsl_eval(ChildBuilder.new(group), &block)
end

#mixin(name, &block) ⇒ Object



28
29
30
31
32
# File 'lib/faith/dsl.rb', line 28

def mixin(name, &block)
  DSL.validate_name!(name)

  @parent.children << Docile.dsl_eval(MixinBuilder.new(name, @parent), &block).result
end

#sequence(name, &block) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/faith/dsl.rb', line 43

def sequence(name, &block)
  DSL.validate_name!(name)

  seq = Sequence.new(name, @parent, [])
  @parent.children << seq

  Docile.dsl_eval(ChildBuilder.new(seq), &block)
end

#task(name, mixins: [], dependencies: [], &action) ⇒ Object



22
23
24
25
26
# File 'lib/faith/dsl.rb', line 22

def task(name, mixins: [], dependencies: [], &action)
  DSL.validate_name!(name)
  
  @parent.children << Task.new(name, @parent, mixins: mixins, dependencies: dependencies, &action)
end