Class: Splicer::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/splicer/zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ttl = 3600) ⇒ Zone

Returns a new instance of Zone.

Parameters:

  • name (String)

    the name of the zone



9
10
11
12
13
# File 'lib/splicer/zone.rb', line 9

def initialize(name, ttl=3600)
  @name = name
  @ttl  = ttl
  @records = Array.new
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/splicer/zone.rb', line 4

def name
  @name
end

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'lib/splicer/zone.rb', line 6

def records
  @records
end

#ttlObject

Returns the value of attribute ttl.



4
5
6
# File 'lib/splicer/zone.rb', line 4

def ttl
  @ttl
end

Instance Method Details

#add_record(record) ⇒ Boolean

Adds a single record to this zone

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/splicer/zone.rb', line 17

def add_record(record)
  return false unless record.is_a?(Splicer::Records::Record)
  @records.push(record)
  true
end

#add_records(records) ⇒ Boolean

Adds a set of records to this zone

Returns:

  • (Boolean)


25
26
27
# File 'lib/splicer/zone.rb', line 25

def add_records(records)
  records.each { |r| add_record(r) }
end