Class: LiveCable::Generators::ComponentGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_component_fileObject



15
16
17
# File 'lib/generators/live_cable/component/component_generator.rb', line 15

def create_component_file
  template 'component.rb.tt', File.join('app/live', class_path, "#{file_name}.rb")
end

#create_view_fileObject



19
20
21
22
23
24
25
26
27
# File 'lib/generators/live_cable/component/component_generator.rb', line 19

def create_view_file
  if compound?
    template 'view.html.live.erb.tt',
      File.join('app/views/live', class_path, file_name, 'component.html.live.erb')
  else
    template 'view.html.live.erb.tt',
      File.join('app/views/live', class_path, "#{file_name}.html.live.erb")
  end
end