Class: DNSer::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/dnser/record.rb

Direct Known Subclasses

BaseRecord, SoaRecord

Defined Under Namespace

Classes: EmptyValue, Unknown

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain, host, params = {}) ⇒ Record

Returns a new instance of Record.



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dnser/record.rb', line 24

def initialize domain, host, params = {}

  ttl domain.ttl
  priority 0 unless @priority_val

  unless host.is_a? Symbol
    @host = host.dup
  else
    @host = host
  end

  @domain = domain
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



4
5
6
# File 'lib/dnser/record.rb', line 4

def domain
  @domain
end

#hostObject



49
50
51
# File 'lib/dnser/record.rb', line 49

def host
  DNSer.config.full_domain ? expand_domain(@host.to_s) : collapse_domain(@host.to_s)
end

Instance Method Details

#comment(v = nil) ⇒ Object



70
71
72
73
# File 'lib/dnser/record.rb', line 70

def comment(v = nil)
  @comment = v if v
  @comment || ''
end

#full_hostObject



53
54
55
56
57
58
59
60
# File 'lib/dnser/record.rb', line 53

def full_host
  short_host = host
  if short_host == '@'
    domain.name
  else
    [short_host, domain.name].join('.')
  end
end

#priority(*args) ⇒ Object Also known as: prio



42
43
44
45
# File 'lib/dnser/record.rb', line 42

def priority(*args)
  @priority_val = args.first if args.size == 1
  @priority_val
end

#ttl(value) ⇒ Object



38
39
40
# File 'lib/dnser/record.rb', line 38

def ttl(value)
  @ttl = value
end

#typeObject

Raises:

  • (NotImplementedError)


62
63
64
# File 'lib/dnser/record.rb', line 62

def type
  raise NotImplementedError
end

#valueObject

Raises:

  • (NotImplementedError)


66
67
68
# File 'lib/dnser/record.rb', line 66

def value
  raise NotImplementedError
end