Sha256: b69da6329f91e0f30d5080fb3948e4b93cb8d58debee7ef12916932edbceaf95

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'rails/generators'

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

    desc 'Enjoy::Gallery EmbeddedImage Model generator'
    def embedded_image
      template 'embedded_image.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 underscored_parent_class_name
      parent_class_name.underscore
    end

    def camelcased_parent_class_name
      parent_class_name.camelcase
    end

    def parent_class_name
      parent_class_name_arg.blank? ? "SetParentClassForEmbeddedImage" : parent_class_name_arg
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enjoy_cms_gallery-0.4.1 lib/generators/enjoy/gallery/models/embedded_image_generator.rb
enjoy_cms_gallery-0.4.0.2 lib/generators/enjoy/gallery/models/embedded_image_generator.rb
enjoy_cms_gallery-0.4.0.1 lib/generators/enjoy/gallery/models/embedded_image_generator.rb
enjoy_cms_gallery-0.4.0 lib/generators/enjoy/gallery/models/embedded_image_generator.rb
enjoy_cms_gallery-0.4.0.beta3 lib/generators/enjoy/gallery/models/embedded_image_generator.rb
enjoy_cms_gallery-0.4.0.beta1 lib/generators/enjoy/gallery/models/embedded_image_generator.rb