Class: Nymphia::DSL

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

Defined Under Namespace

Modules: RecursiveMethods Classes: Context

Instance Method Summary collapse

Constructor Details

#initialize(dsl_code, path) ⇒ DSL

Returns a new instance of DSL.



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

def initialize(dsl_code, path)
  @dsl_code = dsl_code
  @path = path
end

Instance Method Details

#compileObject



11
12
13
# File 'lib/nymphia/dsl.rb', line 11

def compile
  @result = Nymphia::DSL::Context.eval(@dsl_code, @path).result
end

#render(output) ⇒ Object



15
16
17
18
# File 'lib/nymphia/dsl.rb', line 15

def render(output)
  ssh_config = ERB.new(File.read(find_template('ssh_config_template.erb')), nil, '-').result(binding)
  output.write(ssh_config)
end