Class: Miam::DSL::Context
- Inherits:
-
Object
- Object
- Miam::DSL::Context
- Includes:
- TemplateHelper
- Defined in:
- lib/miam/dsl/context.rb
Defined Under Namespace
Classes: Group, ManagedPolicy, Role, User
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, options = {}, &block) ⇒ Context
constructor
A new instance of Context.
- #template(name, &block) ⇒ Object
Methods included from TemplateHelper
Constructor Details
#initialize(path, options = {}, &block) ⇒ Context
Returns a new instance of Context.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/miam/dsl/context.rb', line 12 def initialize(path, = {}, &block) @path = path @options = @result = {:users => {}, :groups => {}, :roles => {}, :instance_profiles => {}, :policies => {}, :exclude => []} @context = Hashie::Mash.new( :path => path, :options => , :templates => {} ) instance_eval(&block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/miam/dsl/context.rb', line 10 def result @result end |
Class Method Details
.eval(dsl, path, options = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/miam/dsl/context.rb', line 4 def self.eval(dsl, path, = {}) self.new(path, ) { eval(dsl, binding, path) } end |
Instance Method Details
#template(name, &block) ⇒ Object
26 27 28 |
# File 'lib/miam/dsl/context.rb', line 26 def template(name, &block) @context.templates[name.to_s] = block end |