Sha256: 2df484749565361fd47a515977435499043b821917a3f8de28f573e744dfa3f4

Contents?: true

Size: 456 Bytes

Versions: 2

Compression:

Stored size: 456 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
    empty_directory 'app/enums'
    template "enum.rb", "app/enums/#{file_name}.rb"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
classy_enum-0.6.1 lib/generators/classy_enum/classy_enum_generator.rb
classy_enum-0.6.0 lib/generators/classy_enum/classy_enum_generator.rb