Sha256: 124f3d9550d89ae84b4ea41e705253cc27af352e119729b80e0c69b3c493ee30

Contents?: true

Size: 652 Bytes

Versions: 3

Compression:

Stored size: 652 Bytes

Contents

require 'rails/generators'
module Hyperloop
  class Component < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)

    argument :components, type: :array
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyper-rails-0.4.1 lib/generators/hyperloop/component_generator.rb
hyper-rails-0.4.0 lib/generators/hyperloop/component_generator.rb
hyper-rails-0.3.0 lib/generators/hyperloop/component_generator.rb