File: null.rb

package info (click to toggle)
ruby-net-dns 0.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 452 kB
  • sloc: ruby: 3,944; makefile: 6
file content (50 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module Net # :nodoc:
  module DNS
    class RR
      #------------------------------------------------------------
      # RR type NULL
      #------------------------------------------------------------
      class NULL < RR
        attr_reader :null

        private

        def build_pack
          @null_pack = @null
          @rdlength = @null_pack.size
        end

        def get_data
          @null_pack
        end

        def get_inspect
          @null.to_s
        end

        def subclass_new_from_hash(args)
          if args.key? :null
            @null = args[:null]
          else
            raise ArgumentError, ":null field is mandatory but missing"
          end
        end

        def subclass_new_from_string(str)
          @null = str.strip
        end

        def subclass_new_from_binary(data, offset)
          @null = data[offset..offset + @rdlength]
          offset + @rdlength
        end

        private

        def set_type
          @type = Net::DNS::RR::Types.new("NULL")
        end
      end
    end
  end
end