Class: RbsDraper::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/rbs_draper/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_raketaskObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/rbs_draper/install_generator.rb', line 7

def create_raketask
  create_file "lib/tasks/rbs_draper.rake", <<~RUBY
    begin
      # frozen_string_literal: true

      require "rbs_draper/rake_task"

      RbsDraper::RakeTask.new do |task|
        # If you have decorators having different names from models, you can specify the mapping from decorator names to model names.
        # The value should be a lambda that returns a hash to load decorators and models easily.
        #
        # task.mapping = -> { { AdminUserDecorator => User } }
      end
    rescue LoadError
      # failed to load rbs_draper. Skip to load rbs_draper tasks.
    end
  RUBY
end