Sha256: 9948a2354b0ecf0a80a211322dd34048e4b864542fdc65860141ae571c4a3d38

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module TinyFilter
  module Generators
    class FilterGenerator < ::Rails::Generators::NamedBase
      source_root File.expand_path("templates", __dir__)

      argument :keys, type: :array, required: false, default: []

      desc "This generator creates a filter for provided model"

      def create_filter
        template_file = File.join("app/filters", class_path, filter_file_name)
        template "filter.rb.erb", template_file
      end

      private

      def filter_file_name
        "#{file_name}_filter.rb"
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tiny_filter-0.1.1 lib/generators/tiny_filter/filter/filter_generator.rb
tiny_filter-0.1.0 lib/tiny_filter/generators/tiny_filter/filter/filter_generator.rb