Class: CodeTemplater
- Inherits:
-
Object
- Object
- CodeTemplater
- Defined in:
- lib/ccios/code_templater.rb
Instance Method Summary collapse
- #content_for_suffix(prefix, suffix) ⇒ Object
-
#initialize(options = {}, templates_path) ⇒ CodeTemplater
constructor
A new instance of CodeTemplater.
Constructor Details
#initialize(options = {}, templates_path) ⇒ CodeTemplater
Returns a new instance of CodeTemplater.
5 6 7 8 |
# File 'lib/ccios/code_templater.rb', line 5 def initialize( = {}, templates_path) @options = @templates_path = templates_path end |
Instance Method Details
#content_for_suffix(prefix, suffix) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/ccios/code_templater.rb', line 10 def content_for_suffix(prefix, suffix) template_name = suffix.underscore = @options.merge({name: prefix, lowercased_name: prefix.camelize(:lower)}) template_file = File.join(@templates_path, "#{template_name}.mustache") Mustache.render(File.read(template_file), ) end |