Class: DNSZone

Inherits:
Object
  • Object
show all
Defined in:
lib/hpc/dns.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

Method: DNSZone#initialize

Defined in:
lib/hpc/dns.rb

- (DNSZone) initialize(base)

Returns a new instance of DNSZone



125
126
127
128
129
# File 'lib/hpc/dns.rb', line 125

def initialize(base)
  @base = base
  @net = nil # opt attr, ipaddr of reverse zone's network
  @entries = Array.new
end

Instance Attribute Details

Method: DNSZone#base

Defined in:
lib/hpc/dns.rb

- (Object) base (readonly)

Returns the value of attribute base



121
122
123
# File 'lib/hpc/dns.rb', line 121

def base
  @base
end

Method: DNSZone#entries

Defined in:
lib/hpc/dns.rb

- (Object) entries (readonly)

Returns the value of attribute entries



123
124
125
# File 'lib/hpc/dns.rb', line 123

def entries
  @entries
end

Method: DNSZone#net

Defined in:
lib/hpc/dns.rb

- (Object) net

Returns the value of attribute net



122
123
124
# File 'lib/hpc/dns.rb', line 122

def net
  @net
end

Instance Method Details

Method: DNSZone#add_entry

Defined in:
lib/hpc/dns.rb

- (Object) add_entry(owner, proto, type, data)



131
132
133
# File 'lib/hpc/dns.rb', line 131

def add_entry(owner, proto, type, data)
  @entries << DNSEntry.new(owner, proto, type, data)
end

Method: DNSZone#dump

Defined in:
lib/hpc/dns.rb

- (Object) dump



135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/hpc/dns.rb', line 135

def dump()
  result = Hash.new
  result['type'] = 'master'
  result['entries'] = Array.new
  @entries.each do |entry|
    result['entries'] << { 'owner' => entry.owner,
                           'proto' => entry.proto,
                           'type'  => entry.type,
                           'data'  => entry.data }
  end
  return result
end