Sha256: 2f561c00daa892f8a83cb1183e5e5cb12e8003b5c8d65f2cc20da5c9fe66253c

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

require "rails/generators"
module Reactrb
  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

2 entries across 2 versions & 1 rubygems

Version Path
reactive_rails_generator-0.2.1 lib/generators/reactrb/component_generator.rb
reactive_rails_generator-0.2.0 lib/generators/reactrb/component_generator.rb