Method: Net::DNS::RR::Types#initialize
- Defined in:
- lib/net/dns/rr/types.rb
#initialize(type) ⇒ Types
Creates a new object representing an RR type. Performs some checks on the argument validity too. Il type is nil, the default value is ANY or the one set with Types.default=
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/net/dns/rr/types.rb', line 121 def initialize(type) case type when String # type in the form "A" or "NS" new_from_string(type.upcase) when Fixnum # type in numeric form new_from_num(type) when nil # default type, control with Types.default= @str = TYPES.invert[@@default] @num = @@default else raise ArgumentError, "Wrong type class: #{type.class}" end end |