Class: Nymphia::DSL::Context

Inherits:
Object
  • Object
show all
Includes:
RecursiveMethods
Defined in:
lib/nymphia/dsl/context.rb

Defined Under Namespace

Modules: HostContextMethods Classes: DefaultParams, Gateway, Group, Host, Proxy, UseGateway

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, &block) ⇒ Context

Returns a new instance of Context.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nymphia/dsl/context.rb', line 14

def initialize(path, &block)
  @path = path

  @context = {
    identity_files: {},
    gateways: {},
    default_params: {},
    gateway_usage: {},
  }

  @result = {
    hosts: [],
  }

  instance_eval(&block)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/nymphia/dsl/context.rb', line 6

def result
  @result
end

Class Method Details

.eval(dsl_code, path) ⇒ Object



8
9
10
11
12
# File 'lib/nymphia/dsl/context.rb', line 8

def self.eval(dsl_code, path)
  new(path) do
    eval(dsl_code, binding, path)
  end
end