Class: WebammToRails::Sources::Gemfile::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/webamm_to_rails/sources/gemfile/definition.rb

Instance Method Summary collapse

Constructor Details

#initialize(waml_definition:) ⇒ Definition

Returns a new instance of Definition.



9
10
11
# File 'lib/webamm_to_rails/sources/gemfile/definition.rb', line 9

def initialize(waml_definition:)
  @waml_definition = waml_definition
end

Instance Method Details

#renderObject



13
14
15
16
17
18
19
# File 'lib/webamm_to_rails/sources/gemfile/definition.rb', line 13

def render
  template_path = File.expand_path('template.erb', __dir__)
  template_content = File.read(template_path)
  raw_content = ERB.new(template_content, trim_mode: '-').result(instance_eval { binding })

  ::WebammToRails::Utils::FormatCode.call(raw_content)
end