Sha256: 69e057c23678ea3fa8b300ebd9a6141eb399ded13d7a88e51d6002490c3f0c46

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require 'rails/generators'

module Hancock::Search::Controllers
  class SearchGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    argument :class_name_arg, type: :string, default: ""

    desc 'Hancock::Search Transfer Controller generator'
    def search
      template 'search.erb', "app/controllers/#{file_name}.rb"
    end

    private
    def class_name
      class_name_arg.blank? ? "SetClassForSearchController" : class_name_arg
    end

    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

1 entries across 1 versions & 1 rubygems

Version Path
hancock_cms_search-1.0.2 lib/generators/hancock/search/controllers/search_generator.rb