Sha256: 443716ce4a1364c3034aabae93ee5f967433e8a38a182d1388cd417f6a5c0539

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

require 'rails/generators'

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

    desc 'Enjoy::News News Model generator'
    def news
      template 'news.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

5 entries across 5 versions & 1 rubygems

Version Path
enjoy_cms_news-0.4.1 lib/generators/enjoy/news/models/news_generator.rb
enjoy_cms_news-0.4.0.2 lib/generators/enjoy/news/models/news_generator.rb
enjoy_cms_news-0.4.0.1 lib/generators/enjoy/news/models/news_generator.rb
enjoy_cms_news-0.4.0 lib/generators/enjoy/news/models/news_generator.rb
enjoy_cms_news-0.4.0.beta3 lib/generators/enjoy/news/models/news_generator.rb