Class: Reactrb::Router

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

Instance Method Summary collapse

Instance Method Details

#create_component_fileObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/reactrb/router_generator.rb', line 6

def create_component_file
  self.components.each do |component|
    component_array = component.split('::')
    @modules = component_array[0..-2]
    @file_name = component_array.last
    @indet = 1
    template 'router_template.rb',
             File.join('app/views/components',
                       @modules.map(&:downcase).join('/'),
                       "#{@file_name.underscore}.rb")
  end
end