Sha256: 730386e930cda684b0b4fa29e988e96b1ee6de975be27e3833a81ca6b81cf482

Contents?: true

Size: 466 Bytes

Versions: 26

Compression:

Stored size: 466 Bytes

Contents

class ClassyEnumGenerator < Rails::Generators::NamedBase
  desc "Generate a ClassyEnum definition in app/enums/"

  argument :name, :type => :string, :required => true, :banner => 'EnumName'
  argument :values, :type => :array, :default => [], :banner => 'value1 value2 value3 etc...'

  source_root File.expand_path("../templates", __FILE__)

  def copy_files # :nodoc:
    empty_directory 'app/enums'
    template "enum.rb", "app/enums/#{file_name}.rb"
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
classy_enum-1.0.0 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.9.1 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.8.1 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.8.0 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.7.1 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.7.0 lib/generators/classy_enum/classy_enum_generator.rb