Sha256: 194752923bfdc7cf5935feb64e23a7d20f80e8f5f64341578cc9470989df6bca

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

module Slayer
  module Generators
    class FormGenerator < NamedBase
      desc "This generator creates new Slayer::Forms"

      source_root File.expand_path("../templates", __FILE__)
      check_class_collision suffix: "Form"

      argument :name, type: :string
      argument :fields, :type => :array, :required => false, :desc => "The attributes of the generated form. name:String completed:Boolean"

      def initialize(args, *options) #:nodoc:
        super
        args.shift
        @fields = args.map{|a| a.split(":")}
      end

      def create_form_files
        template "form.rb", File.join("app", "forms", class_path, "#{file_name}_form.rb")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slayer_rails-0.4.0.beta4 lib/generators/form/form_generator.rb
slayer_rails-0.4.0.beta3 lib/generators/form/form_generator.rb
slayer_rails-0.3.3 lib/generators/form/form_generator.rb
slayer_rails-0.3.2 lib/generators/form/form_generator.rb
slayer_rails-0.3.1 lib/generators/form/form_generator.rb