Module: RamlRubyClient::Generator::TemplateHelper

Included in:
Context
Defined in:
lib/raml_ruby_client/generator/template.rb

Instance Method Summary collapse

Instance Method Details

#include(partial, context) ⇒ Object



10
11
12
13
# File 'lib/raml_ruby_client/generator/template.rb', line 10

def include(partial, context)
  template = Template.new(sprintf("_%s.tmpl", partial))
  template.render(context)
end

#indent(str, spaces) ⇒ Object



15
16
17
18
19
20
# File 'lib/raml_ruby_client/generator/template.rb', line 15

def indent(str, spaces)
  pre = ' ' * spaces
  str = pre + str.split(/\n/).join("\n" + pre) + "\n"
  return str unless str.strip.empty?
  nil
end