Class: Toolchest::Generators::ToolboxGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/toolchest/toolbox_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_specObject



26
# File 'lib/generators/toolchest/toolbox_generator.rb', line 26

def create_spec = template "toolbox_spec.rb.tt", "spec/toolboxes/#{file_path}_toolbox_spec.rb"

#create_toolboxObject



12
# File 'lib/generators/toolchest/toolbox_generator.rb', line 12

def create_toolbox = template "toolbox.rb.tt", "app/toolboxes/#{file_path}_toolbox.rb"

#create_viewsObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/toolchest/toolbox_generator.rb', line 14

def create_views
  return if actions.empty?

  actions.each do |action|
    create_file "app/views/toolboxes/#{file_path}/#{action}.json.jb", <<~JB
      {
        # TODO: return data for #{toolbox_name.underscore}##{action}
      }
    JB
  end
end