Class: RBus::Message::Base
- Inherits:
-
Object
- Object
- RBus::Message::Base
- Includes:
- Flags, HeaderFields, MessageTypes
- Defined in:
- lib/rbus/message/message.rb
Overview
Base implementation for the different message types.
Direct Known Subclasses
Constant Summary
Constants included from Flags
Flags::EMPTY, Flags::NO_AUTO_START, Flags::NO_REPLY_EXPECTED
Constants included from HeaderFields
HeaderFields::DESTINATION, HeaderFields::ERROR_NAME, HeaderFields::INTERFACE, HeaderFields::MEMBER, HeaderFields::PATH, HeaderFields::REPLY_SERIAL, HeaderFields::SENDER, HeaderFields::SIGNATURE
Constants included from MessageTypes
MessageTypes::ERROR, MessageTypes::INVALID, MessageTypes::METHOD_CALL, MessageTypes::METHOD_RETURN, MessageTypes::SIGNAL
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#body ⇒ Object
Returns the value of attribute body.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#member ⇒ Object
Returns the value of attribute member.
-
#object_path ⇒ Object
Returns the value of attribute object_path.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #header_fields ⇒ Object
-
#initialize {|_self| ... } ⇒ Base
constructor
A new instance of Base.
- #no_auto_start=(bool) ⇒ Object
- #no_reply=(bool) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Base
Returns a new instance of Base.
45 46 47 48 49 50 51 |
# File 'lib/rbus/message/message.rb', line 45 def initialize @flags ||= EMPTY @body = '' @serial = SerialGenerator.get_unique @type ||= INVALID yield self if block_given? end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
38 39 40 |
# File 'lib/rbus/message/message.rb', line 38 def arguments @arguments end |
#body ⇒ Object
Returns the value of attribute body.
40 41 42 |
# File 'lib/rbus/message/message.rb', line 40 def body @body end |
#destination ⇒ Object
Returns the value of attribute destination.
35 36 37 |
# File 'lib/rbus/message/message.rb', line 35 def destination @destination end |
#flags ⇒ Object
Returns the value of attribute flags.
40 41 42 |
# File 'lib/rbus/message/message.rb', line 40 def flags @flags end |
#interface ⇒ Object
Returns the value of attribute interface.
35 36 37 |
# File 'lib/rbus/message/message.rb', line 35 def interface @interface end |
#member ⇒ Object
Returns the value of attribute member.
36 37 38 |
# File 'lib/rbus/message/message.rb', line 36 def member @member end |
#object_path ⇒ Object
Returns the value of attribute object_path.
36 37 38 |
# File 'lib/rbus/message/message.rb', line 36 def object_path @object_path end |
#sender ⇒ Object
Returns the value of attribute sender.
37 38 39 |
# File 'lib/rbus/message/message.rb', line 37 def sender @sender end |
#serial ⇒ Object
Returns the value of attribute serial.
43 44 45 |
# File 'lib/rbus/message/message.rb', line 43 def serial @serial end |
#signature ⇒ Object
Returns the value of attribute signature.
38 39 40 |
# File 'lib/rbus/message/message.rb', line 38 def signature @signature end |
#type ⇒ Object
Returns the value of attribute type.
42 43 44 |
# File 'lib/rbus/message/message.rb', line 42 def type @type end |
Instance Method Details
#header_fields ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/rbus/message/message.rb', line 70 def header_fields hf = [] @object_path and hf << [PATH, Variant.new(@object_path, 'o')] @interface and hf << [INTERFACE, Variant.new(@interface, 's')] @member and hf << [MEMBER, Variant.new(@member, 's')] @destination and hf << [DESTINATION, Variant.new(@destination, 's')] @signature and hf << [SIGNATURE, Variant.new(@signature, 'g')] hf end |
#no_auto_start=(bool) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/rbus/message/message.rb', line 62 def no_auto_start=(bool) if bool @flags |= NO_AUTO_START else @flags &= ~ NO_AUTO_START end end |
#no_reply=(bool) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/rbus/message/message.rb', line 53 def no_reply=(bool) if bool @flags |= NO_REPLY_EXPECTED else @flags &= ~ NO_REPLY_EXPECTED end puts "FLAGS: #{@flags}" end |