Method: Dnsruby::CodeMapper#initialize
- Defined in:
- lib/dnsruby/code_mapper.rb
#initialize(arg) ⇒ CodeMapper
:nodoc: all
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/dnsruby/code_mapper.rb', line 95 def initialize(arg) #:nodoc: all array = @@arrays[self.class] if (arg.kind_of?String) arg = arg.gsub("_", "-") code = array.stringsdown[arg.downcase] if (code != nil) @code = code @string = array.values[@code] else unknown_string(arg) end elsif arg.kind_of?(Integer) if (array.values[arg] != nil) @code = arg @string = array.values[@code] else unknown_code(arg) end elsif (arg.kind_of?self.class) @code = arg.code @string = array.values[@code] else raise ArgumentError.new("Unknown argument of type #{arg.class}: #{arg} for #{self.class}") end end |