Class: BoomNats::ConsumerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/boom_nats/consumer_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_consumer_classObject



5
6
7
8
9
10
11
12
13
# File 'lib/generators/boom_nats/consumer_generator.rb', line 5

def create_consumer_class
  create_file "app/consumers/#{file_name}_consumer.rb", <<~FILE
    class #{class_name}Consumer < BoomNats::Topic
      def consume
        { message: "Hello \#{params["name"]}, how are you?" }
      end
    end
  FILE
end