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.



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

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

Instance Method Details

#compileObject



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

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

#render(output) ⇒ Object



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

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