Sha256: 44a41898f8753a49533454ae2b2b65c856a43ab09abff5d81dbbe4c621c048a7

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

require 'rails/generators'

module Hancock::Catalog::Controllers
  class AllGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    argument :class_name, type: :string
    argument :category_class_name_arg, type: :string, default: ""

    desc 'Hancock::Catalog Controllers generator'
    def all
      generate "hancock:catalog:controllers:item #{camelcased_class_name}"
      generate "hancock:catalog:controllers:category #{category_class_name}"
    end

    private
    def capitalized_class_name
      class_name.capitalize
    end
    def camelcased_class_name
      class_name.camelcase
    end

    def category_class_name
      category_class_name_arg.blank? ? "#{camelcased_class_name}Category" : category_class_name_arg
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hancock_cms_catalog-1.0.2 lib/generators/hancock/catalog/controllers/all_generator.rb