Module: PowerApi::GeneratorHelper::TemplateBuilderHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/power_api/generator_helper/template_builder_helper.rb

Instance Method Summary collapse

Instance Method Details

#concat_tpl_method(method_name, *method_lines) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/power_api/generator_helper/template_builder_helper.rb', line 8

def concat_tpl_method(method_name, *method_lines)
  concat_tpl_statements(
    "def #{method_name}",
    *method_lines,
    "end"
  )
end

#concat_tpl_statements(*methods) ⇒ Object



4
5
6
# File 'lib/power_api/generator_helper/template_builder_helper.rb', line 4

def concat_tpl_statements(*methods)
  methods.reject(&:blank?).join("\n")
end

#tpl_class(class_def, *statements) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/power_api/generator_helper/template_builder_helper.rb', line 16

def tpl_class(class_def, *statements)
  concat_tpl_statements(
    "class #{class_def}",
    *statements,
    "end\n"
  )
end