Class: RamlRubyClient::Generator::Template
- Inherits:
-
Object
- Object
- RamlRubyClient::Generator::Template
- Defined in:
- lib/raml_ruby_client/generator/template.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(template_name) ⇒ Template
constructor
A new instance of Template.
- #render(context) ⇒ Object
Constructor Details
#initialize(template_name) ⇒ Template
Returns a new instance of Template.
36 37 38 39 |
# File 'lib/raml_ruby_client/generator/template.rb', line 36 def initialize(template_name) file = File.join(TEMPLATE_DIR, template_name) @erb = ERB.new(File.read(file), nil, '-') end |
Class Method Details
Instance Method Details
#render(context) ⇒ Object
41 42 43 44 |
# File 'lib/raml_ruby_client/generator/template.rb', line 41 def render(context) ctx = Context.new(context) @erb.result(ctx.to_binding) end |