Sha256: 7ff1403fb57caa88e070cc84e7359d151403679e5bda716cf0f340cf386a2a42
Contents?: true
Size: 999 Bytes
Versions: 9
Compression:
Stored size: 999 Bytes
Contents
require 'rails/generators' module Enjoy::Catalog::Models class CategoryGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :class_name, type: :string argument :item_class_name_arg, type: :string, default: "" desc 'Enjoy::Catalog Category Model generator' def category template 'category.erb', "app/models/#{file_name}.rb" end private def capitalized_class_name class_name.capitalize end def camelcased_class_name class_name.camelcase end def file_name underscored_class_name end def underscored_class_name camelcased_class_name.underscore end def underscored_pluralized_class_name underscored_class_name.pluralize end def camelcased_item_class_name item_class_name.camelcase end def item_class_name item_class_name_arg.blank? ? camelcased_class_name.sub(/Category$/i, "") : item_class_name_arg end end end
Version data entries
9 entries across 9 versions & 1 rubygems