Method: Net::DNS::RR::Classes#initialize

Defined in:
lib/net/dns/rr/classes.rb

#initialize(cls) ⇒ Classes

Creates a new object representing an RR class. Performs some checks on the argument validity too. Il cls is nil, the default value is ANY or the one set with Classes.default=



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/net/dns/rr/classes.rb', line 31

def initialize(cls)
  case cls
    when String
      initialize_from_str(cls)
    when Fixnum
      initialize_from_num(cls)
    when nil
      initialize_from_num(@@default)
  end

  if @str.nil? || @num.nil?
    raise ArgumentError, "Unable to create a `Classes' from `#{cls}'"
  end
end