Class: RubyNos::Processor
- Inherits:
-
Object
- Object
- RubyNos::Processor
- Defined in:
- lib/ruby_nos/processor.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#current_message ⇒ Object
Returns the value of attribute current_message.
Instance Method Summary collapse
- #formatter ⇒ Object
-
#initialize(agent) ⇒ Processor
constructor
A new instance of Processor.
- #process_message(received_message) ⇒ Object
- #signature_generator ⇒ Object
Constructor Details
#initialize(agent) ⇒ Processor
Returns a new instance of Processor.
6 7 8 |
# File 'lib/ruby_nos/processor.rb', line 6 def initialize agent @agent = agent end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
4 5 6 |
# File 'lib/ruby_nos/processor.rb', line 4 def agent @agent end |
#current_message ⇒ Object
Returns the value of attribute current_message.
4 5 6 |
# File 'lib/ruby_nos/processor.rb', line 4 def @current_message end |
Instance Method Details
#formatter ⇒ Object
10 11 12 |
# File 'lib/ruby_nos/processor.rb', line 10 def formatter @formatter ||= Formatter.new end |
#process_message(received_message) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_nos/processor.rb', line 18 def = formatter.() self. = Message.new() unless sender_uuid == agent.uuid || !correct_signature?() RubyNos.logger.send(:info, "#{self..type} arrives") if agent_receptor? || cloud_receptor? processor = .fetch(.type, nil) processor.call if processor end end end |
#signature_generator ⇒ Object
14 15 16 |
# File 'lib/ruby_nos/processor.rb', line 14 def signature_generator @signature_generator ||= SignatureGenerator.new end |