Class: DnsMock::Response::Message
- Inherits:
-
Object
- Object
- DnsMock::Response::Message
- Defined in:
- lib/dns_mock/response/message.rb
Instance Attribute Summary collapse
-
#dns_message ⇒ Object
readonly
Returns the value of attribute dns_message.
Instance Method Summary collapse
- #as_binary_string ⇒ Object
-
#initialize(packet, records, exception_if_not_found, dns_answer = DnsMock::Response::Answer, dns_message = ::Resolv::DNS::Message) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(packet, records, exception_if_not_found, dns_answer = DnsMock::Response::Answer, dns_message = ::Resolv::DNS::Message) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dns_mock/response/message.rb', line 8 def initialize( packet, records, exception_if_not_found, dns_answer = DnsMock::Response::Answer, = ::Resolv::DNS::Message ) @dns_answer = dns_answer.new(records, exception_if_not_found) @dns_message = .decode(packet) end |
Instance Attribute Details
#dns_message ⇒ Object (readonly)
Returns the value of attribute dns_message.
6 7 8 |
# File 'lib/dns_mock/response/message.rb', line 6 def @dns_message end |
Instance Method Details
#as_binary_string ⇒ Object
19 20 21 22 23 24 |
# File 'lib/dns_mock/response/message.rb', line 19 def as_binary_string @as_binary_string ||= begin compose_answer .encode end end |