Class: SyslogTls::Message
- Inherits:
-
Object
- Object
- SyslogTls::Message
- Defined in:
- lib/syslog_tls/protocol.rb
Overview
Message represents full message that can be sent to syslog
Instance Attribute Summary collapse
- #header ⇒ Object
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#structured_data ⇒ Object
Returns the value of attribute structured_data.
Instance Method Summary collapse
- #assemble ⇒ Object
-
#initialize ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
115 116 117 118 |
# File 'lib/syslog_tls/protocol.rb', line 115 def initialize @msg = '' @structured_data = [] end |
Instance Attribute Details
#header ⇒ Object
120 121 122 |
# File 'lib/syslog_tls/protocol.rb', line 120 def header @header ||= Header.new end |
#msg ⇒ Object
Returns the value of attribute msg.
112 113 114 |
# File 'lib/syslog_tls/protocol.rb', line 112 def msg @msg end |
#structured_data ⇒ Object
Returns the value of attribute structured_data.
112 113 114 |
# File 'lib/syslog_tls/protocol.rb', line 112 def structured_data @structured_data end |
Instance Method Details
#assemble ⇒ Object
124 125 126 127 128 129 130 131 |
# File 'lib/syslog_tls/protocol.rb', line 124 def assemble # Start with header out = [header.to_s] # Add message out << msg if msg.length > 0 # Message must end with new line delimiter out.join(' ') + "\n" end |
#to_s ⇒ Object
133 134 135 |
# File 'lib/syslog_tls/protocol.rb', line 133 def to_s assemble end |