class TinyDNS::Record

Public Class Methods

new(params = {}) click to toggle source
# File lib/tinydns/record.rb, line 3
def initialize(params = {})
  params.each do |k,v|
    self[k] = v
  end
end

Public Instance Methods

name() click to toggle source
# File lib/tinydns/record.rb, line 26
def name
  self[:name]
end
to_str() click to toggle source
# File lib/tinydns/record.rb, line 38
def to_str
  str = "#{self[:type]}#{name}:#{value}:#{ttl}"
  if self[:other]
    str << ":#{self[:other]}"
  end
  str
end
ttl() click to toggle source
# File lib/tinydns/record.rb, line 34
def ttl
  self[:ttl]
end
type() click to toggle source
# File lib/tinydns/record.rb, line 9
def type
  case self[:type]
    when "C"
      :cname
    when "="
      :a
    when "@"
      :mx
    when "."
      :soa
    when "'"
      :text
    else
      self[:type]
  end
end
value() click to toggle source
# File lib/tinydns/record.rb, line 30
def value
  self[:value]
end