Class: Puffer::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/puffer/component/component_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_componentObject



4
5
6
7
8
# File 'lib/generators/puffer/component/component_generator.rb', line 4

def generate_component
  @name = name.underscore

  template 'component.rb', "app/components/#{@name}_component.rb"
end

#generate_viewsObject



10
11
12
13
14
15
16
# File 'lib/generators/puffer/component/component_generator.rb', line 10

def generate_views
  @name = name.underscore

  create_file "app/components/#{@name}/index.html.erb", "# I'm index"
  create_file "app/components/#{@name}/form.html.erb", "# I'm form"
  create_file "app/components/#{@name}/filter.html.erb", "# I'm filter"
end