File: field.rb

package info (click to toggle)
ruby-ntlm 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: ruby: 2,663; makefile: 6
file content (35 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
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
module Net
module NTLM

  # base classes for primitives
  # @private
  class Field
    attr_accessor :active, :value

    def initialize(opts)
      @value  = opts[:value]
      @active = opts[:active].nil? ? true : opts[:active]
      @size   = opts[:size].nil? ? 0 : opts[:size]
    end

    def size
      @active ? @size : 0
    end

    # Serializer function for field data
    # Exists in this class to be overridden by child classes
    def serialize
      raise NotImplementedError
    end

    # Parser function for field data
    # Exists in this class to be overridden by child classes
    def parse(str, offset=0)
      raise NotImplementedError
    end

  end


end
end