Class: EventMachine::DNSBL::Zone::MemoryZone

Inherits:
AbstractZone show all
Defined in:
lib/eventmachine/dnsbl/zone/memory_zone.rb

Instance Method Summary collapse

Methods inherited from AbstractZone

#get_records

Constructor Details

#initializeMemoryZone

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