Sha256: 16f8bd39ba918f1d3dfa2de03e822813d61918bc16349be066a2a40bd94a0a05

Contents?: true

Size: 652 Bytes

Versions: 6

Compression:

Stored size: 652 Bytes

Contents

require 'rails/generators'
module Hyper
  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/hyperloop/components',
                           @modules.map(&:downcase).join('/'),
                           "#{@file_name.underscore}.rb")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyperloop-0.5.8 lib/generators/hyper/component_generator.rb
hyperloop-0.5.6 lib/generators/hyper/component_generator.rb
hyperloop-0.5.5 lib/generators/hyper/component_generator.rb
hyperloop-0.5.4 lib/generators/hyper/component_generator.rb
hyperloop-0.5.1 lib/generators/hyper/component_generator.rb
hyperloop-0.5.0 lib/generators/hyper/component_generator.rb