Sha256: 06f473d470ce61f34a5ae8ba00f1f27f111bc4aadab8c545cfe390033787e32e

Contents?: true

Size: 711 Bytes

Versions: 14

Compression:

Stored size: 711 Bytes

Contents

require 'rails/generators'

module Enjoy::Catalog::Models
  class ItemGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    argument :class_name, type: :string

    desc 'Enjoy::Catalog Item Model generator'
    def item
      template 'item.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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
enjoy_cms_catalog-0.4.1 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.6 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.5 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.4 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.3 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.2 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.1 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.4.0.beta3 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.3.7 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.3.6 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.3.5 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.3.4 lib/generators/enjoy/catalog/models/item_generator.rb
enjoy_cms_catalog-0.3.3 lib/generators/enjoy/catalog/models/item_generator.rb