Class: Dnsruby::Classes
- Inherits:
-
CodeMapper
- Object
- CodeMapper
- Dnsruby::Classes
- Defined in:
- lib/dnsruby/code_mappers.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, #hash, #initialize, #inspect, method_missing, regexp, #set_code, #set_string, strings, 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
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/dnsruby/code_mappers.rb', line 72 def Classes.classesbyname(name) #:nodoc: all name = 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
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/dnsruby/code_mappers.rb', line 93 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 |