Class: Dnsruby::Classes
- Inherits:
-
CodeMapper
- Object
- CodeMapper
- Dnsruby::Classes
- Defined in:
- lib/dnsruby.rb
Constant Summary collapse
- IN =
RFC 1035
1
- CH =
RFC 1035
3
- HS =
CHAOS = 3 # RFC 1035
4
- NONE =
HESIOD = 4 # RFC 1035
254
- ANY =
RFC 2136
255
Instance Attribute Summary
Attributes inherited from CodeMapper
Class Method Summary collapse
-
.classesbyname(name) ⇒ Object
classesbyval and classesbyname functions are wrappers around the similarly named hashes.
-
.classesbyval(val) ⇒ Object
:nodoc: all.
Instance Method Summary collapse
Methods inherited from CodeMapper
#<=>, #==, add_pair, #initialize, #inspect, maxcode, method_missing, regexp, #set_code, #set_string, to_code, to_string, update
Constructor Details
This class inherits a constructor from Dnsruby::CodeMapper
Class Method Details
.classesbyname(name) ⇒ Object
classesbyval and classesbyname functions are wrappers around the similarly named hashes. They are used for ‘unknown’ DNS RR classess (RFC3597)
See typesbyval and typesbyname, these beasts have the same functionality
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/dnsruby.rb', line 150 def Classes.classesbyname(name) #:nodoc: all name.upcase!; if to_code(name) return to_code(name) end if ((name =~/^\s*CLASS(\d+)\s*$/o) == nil) raise ArgumentError, "classesbyval() argument is not CLASS### (#{name})" end val = $1.to_i if val > 0xffff raise ArgumentError, 'classesbyval() argument larger than ' + 0xffff end return val; end |
.classesbyval(val) ⇒ Object
:nodoc: all
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/dnsruby.rb', line 170 def Classes.classesbyval(val) #:nodoc: all if (val.class == String) if ((val =~ /^\s*0*([0-9]+)\s*$/) == nil) raise ArgumentError, "classesbybal() argument is not numeric (#{val})" # unless val.gsub!("^\s*0*([0-9]+)\s*$", "$1") # val =~ s/^\s*0*([0-9]+)\s*$/$1/o;# end val = $1.to_i end return to_string(val) if to_string(val) raise ArgumentError, 'classesbyval() argument larger than ' + 0xffff if val > 0xffff; return "CLASS#{val}"; end |