Class: MockDnsServer::HistoryInspections
- Inherits:
-
Object
- Object
- MockDnsServer::HistoryInspections
- Defined in:
- lib/mock_dns_server/history_inspections.rb
Constant Summary collapse
- MT =
MessageTransformer
Instance Method Summary collapse
- #all(*inspections) ⇒ Object
- #any(*inspections) ⇒ Object
- #apply(records, inspection) ⇒ Object
- #none(*inspections) ⇒ Object
- #protocol(protocol) ⇒ Object
- #qname(qname) ⇒ Object
- #qtype(qtype) ⇒ Object
- #soa ⇒ Object
- #type(type) ⇒ Object
Instance Method Details
#all(*inspections) ⇒ Object
35 36 37 38 39 |
# File 'lib/mock_dns_server/history_inspections.rb', line 35 def all(*inspections) ->(record) do inspections.all? { |inspection| inspection.(record) } end end |
#any(*inspections) ⇒ Object
41 42 43 44 45 |
# File 'lib/mock_dns_server/history_inspections.rb', line 41 def any(*inspections) ->(record) do inspections.any? { |inspection| inspection.(record) } end end |
#apply(records, inspection) ⇒ Object
53 54 55 |
# File 'lib/mock_dns_server/history_inspections.rb', line 53 def apply(records, inspection) records.select { |record| inspection.(record) } end |
#none(*inspections) ⇒ Object
47 48 49 50 51 |
# File 'lib/mock_dns_server/history_inspections.rb', line 47 def none(*inspections) ->(record) do inspections.none? { |inspection| inspection.(record) } end end |
#protocol(protocol) ⇒ Object
31 32 33 |
# File 'lib/mock_dns_server/history_inspections.rb', line 31 def protocol(protocol) ->(record) { record[:protocol] == protocol } end |
#qname(qname) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/mock_dns_server/history_inspections.rb', line 20 def qname(qname) ->(record) do = MT.new(record[:message]).qname.to_s == qname end end |
#qtype(qtype) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/mock_dns_server/history_inspections.rb', line 13 def qtype(qtype) ->(record) do = MT.new(record[:message]).qtype.to_s == qtype end end |
#soa ⇒ Object
27 28 29 |
# File 'lib/mock_dns_server/history_inspections.rb', line 27 def soa qtype('SOA') end |
#type(type) ⇒ Object
9 10 11 |
# File 'lib/mock_dns_server/history_inspections.rb', line 9 def type(type) ->(record) { record[:type] == type } end |