class MockDnsServer::History
Handles the history of events for this server.
Public Class Methods
new(context)
click to toggle source
# File lib/mock_dns_server/history.rb, line 6 def initialize(context) @context = context @records = ThreadSafe::Array.new end
Public Instance Methods
add(entry_hash)
click to toggle source
# File lib/mock_dns_server/history.rb, line 17 def add(entry_hash) entry_hash[:time] ||= Time.now @records << entry_hash entry_hash end
add_action_not_found(message)
click to toggle source
# File lib/mock_dns_server/history.rb, line 35 def add_action_not_found(message) add( { type: :action_not_found, message: message }) end
add_conditional_action_removal(conditional_action)
click to toggle source
# File lib/mock_dns_server/history.rb, line 43 def add_conditional_action_removal(conditional_action) add( { type: :conditional_action_removal, conditional_action: conditional_action }) end
add_incoming(message, sender, protocol, description = nil)
click to toggle source
# File lib/mock_dns_server/history.rb, line 24 def add_incoming(message, sender, protocol, description = nil) add( { type: :incoming, message: message, sender: sender, protocol: protocol, description: description }) end
add_notify_response(response, zts_host, zts_port, protocol)
click to toggle source
# File lib/mock_dns_server/history.rb, line 51 def add_notify_response(response, zts_host, zts_port, protocol) add( { type: :notify_response, message: response, host: zts_host, port: zts_port, protocol: protocol, description: "notify response from #{zts_host}:#{zts_port}" }) end
copy()
click to toggle source
# File lib/mock_dns_server/history.rb, line 74 def copy @records.map { |record| record.clone } end
occurred?(inspection)
click to toggle source
# File lib/mock_dns_server/history.rb, line 63 def occurred?(inspection) HistoryInspections.new.apply(@records, inspection).size > 0 end
size()
click to toggle source
# File lib/mock_dns_server/history.rb, line 12 def size @records.size end
to_a()
click to toggle source
@return a clone of the array
# File lib/mock_dns_server/history.rb, line 69 def to_a @records.clone end
to_s()
click to toggle source
# File lib/mock_dns_server/history.rb, line 79 def to_s "#{super}: #{@records}" end