Class: LDIF::DSL::ContentBuilder

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

Instance Method Summary collapse

Constructor Details

#initializeContentBuilder

Returns a new instance of ContentBuilder.



8
9
10
11
# File 'lib/ldif/dsl/content_builder.rb', line 8

def initialize
  @groups = []
  @people = []
end

Instance Method Details

#buildObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/ldif/dsl/content_builder.rb', line 23

def build
  billet = "version: 1\n\n"
  billet << organizational_unit('people')
  billet << "\n"
  billet << organizational_unit('groups')
  billet << "\n"
  billet << @groups.join("\n")
  billet << "\n"
  billet << @people.join("\n")
end

#group(&block) ⇒ Object



18
19
20
21
# File 'lib/ldif/dsl/content_builder.rb', line 18

def group(&block)
  @groups.push(Docile.dsl_eval(Group::Builder.new, &block).build)
  self
end

#person(&block) ⇒ Object



13
14
15
16
# File 'lib/ldif/dsl/content_builder.rb', line 13

def person(&block)
  @people.push(Docile.dsl_eval(Person::Builder.new, &block).build)
  self
end