Class: Posgra::DSL::Roles

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper, TemplateHelper, Utils::Helper
Defined in:
lib/posgra/dsl/roles.rb

Defined Under Namespace

Classes: Group

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Helper

#matched?

Methods included from TemplateHelper

#context, #include_template

Methods included from Logger::Helper

#log

Constructor Details

#initialize(path, options = {}, &block) ⇒ Roles

Returns a new instance of Roles.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/posgra/dsl/roles.rb', line 17

def initialize(path, options = {}, &block)
  @path = path
  @options = options
  @result = {
    :users => [],
    :users_by_group => {},
  }

  @context = Hashie::Mash.new(
    :path => path,
    :options => options,
    :templates => {},
  )

  instance_eval(&block)
end

Class Method Details

.eval(dsl, path, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/posgra/dsl/roles.rb', line 6

def self.eval(dsl, path, options = {})
  self.new(path, options) do
    eval(dsl, binding, path)
  end
end

Instance Method Details

#resultObject



12
13
14
15
# File 'lib/posgra/dsl/roles.rb', line 12

def result
  @result.fetch(:users).uniq
  @result
end