Class: EventMachine::DNSBL::Zone::MemoryZone
- Inherits:
-
AbstractZone
- Object
- AbstractZone
- EventMachine::DNSBL::Zone::MemoryZone
- Defined in:
- lib/eventmachine/dnsbl/zone/memory_zone.rb
Instance Method Summary collapse
- #add_dnsblresource(dnsblrr) ⇒ Object
- #get_all_records_for_zone(zone) ⇒ Object
-
#initialize ⇒ MemoryZone
constructor
A new instance of MemoryZone.
Methods inherited from AbstractZone
Constructor Details
#initialize ⇒ MemoryZone
Returns a new instance of MemoryZone.
7 8 9 10 |
# File 'lib/eventmachine/dnsbl/zone/memory_zone.rb', line 7 def initialize @zones = Array.new @backend = Hash.new end |
Instance Method Details
#add_dnsblresource(dnsblrr) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/eventmachine/dnsbl/zone/memory_zone.rb', line 12 def add_dnsblresource(dnsblrr) zone = dnsblrr[:zone] if not @backend[zone] if not @zones.include?(zone) @zones << zone @zones = @zones.uniq.sort {|a,b| b.length <=> a.length} end @backend[zone] = Array.new end @backend[zone] << dnsblrr end |
#get_all_records_for_zone(zone) ⇒ Object
24 25 26 |
# File 'lib/eventmachine/dnsbl/zone/memory_zone.rb', line 24 def get_all_records_for_zone(zone) @backend[zone] end |