Class: Hyper::Router
- Inherits:
-
Rails::Generators::Base
- Object
- Thor::Group
- Rails::Generators::Base
- Hyper::Router
- Defined in:
- lib/generators/hyper/router_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_route ⇒ Object
19 20 21 |
# File 'lib/generators/hyper/router_generator.rb', line 19 def add_route route "get '#{options['path']}', to: 'hyperloop##{@file_name.underscore}'" end |
#create_component_file ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/hyper/router_generator.rb', line 8 def create_component_file component_array = component.split('::') @modules = component_array[0..-2] @file_name = component_array.last @indent = 0 template 'router_template.rb', File.join('app/hyperloop/components', @modules.map(&:downcase).join('/'), "#{@file_name.underscore}.rb") end |