Class: Reactrb::Component

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

Instance Method Summary collapse

Instance Method Details

#create_component_fileObject



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

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 'component_template.rb',
             File.join('app/views/components',
                       @modules.map(&:downcase).join('/'),
                       "#{@file_name.underscore}.rb")
  end
end