Class: DaimonSkycrawlers::Generator::Filter

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/daimon_skycrawlers/generator/filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



10
11
12
# File 'lib/daimon_skycrawlers/generator/filter.rb', line 10

def self.source_root
  File.join(__dir__, "templates")
end

Instance Method Details

#create_filesObject



14
15
16
17
18
19
# File 'lib/daimon_skycrawlers/generator/filter.rb', line 14

def create_files
  config = {
    class_name: name.classify,
  }
  template("filter.rb.erb", "app/filters/#{name.underscore}.rb", config)
end

#display_post_messageObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/daimon_skycrawlers/generator/filter.rb', line 21

def display_post_message
  puts <<MESSAGE

You can use this filter with both crawlers and processors.

    filter = #{name.classify}.new
    crawler = DaimonSkycrawlers::Crawler::Default.new
    crawler.before_process(filter)

MESSAGE
end