class Katapult::Generator

Attributes

element[RW]

Public Class Methods

new(element, options = {}) click to toggle source

@option :force (from Thor): Overwrite on conflict

Calls superclass method
# File lib/katapult/generator.rb, line 13
def initialize(element, options = {})
  self.element = element
  args = [element.name]
  config = {}

  super args, options, config
end

Private Instance Methods

generate(generator_name) click to toggle source
Calls superclass method
# File lib/katapult/generator.rb, line 28
def generate(generator_name)
  args = []
  args << '--force' if options[:force]

  super generator_name, *args
end
render_partial(template_path, given_binding = nil) click to toggle source
# File lib/katapult/generator.rb, line 23
def render_partial(template_path, given_binding = nil)
  path = File.join(self.class.source_root, template_path)
  ERB.new(::File.binread(path), nil, '%').result(given_binding || binding)
end