Class: Pio::Echo::Message
- Inherits:
-
Object
- Object
- Pio::Echo::Message
- Extended by:
- Forwardable
- Defined in:
- lib/pio/echo/message.rb
Overview
Base class of Echo request and reply.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message_type, user_options = {}) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(message_type, user_options = {}) ⇒ Message
Returns a new instance of Message.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pio/echo/message.rb', line 26 def initialize(, = {}) if .respond_to?(:to_i) @options = { transaction_id: .to_i, message_type: } elsif .respond_to?(:[]) @options = .dup.merge(message_type: ) else fail TypeError end @echo = Format.new(@options) end |
Class Method Details
.create_from(echo) ⇒ Object
20 21 22 23 24 |
# File 'lib/pio/echo/message.rb', line 20 def self.create_from(echo) = allocate .instance_variable_set :@echo, echo end |