Class: Arpie::BinaryType

Inherits:
Object
  • Object
show all
Includes:
Arpie
Defined in:
lib/arpie/binary_types.rb

Direct Known Subclasses

BytesBinaryType, FixedBinaryType, ListBinaryType

Constant Summary

Constants included from Arpie

MTU

Instance Method Summary collapse

Methods included from Arpie

#bogon!, #incomplete!

Instance Method Details

#binary_size(opts) ⇒ Object



5
6
7
# File 'lib/arpie/binary_types.rb', line 5

def binary_size opts
  nil
end

#check_limit(value, limit) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/arpie/binary_types.rb', line 23

def check_limit value, limit
  case limit
    when nil
      true
    when Range, Array
      limit.include?(value)
    else
      raise ArgumentError, "unknown limit definition: #{limit.inspect}"
  end or bogon! nil, "not in :limit => #{limit.inspect}"
end

#from(binary, opts) ⇒ Object

Return [object, len]

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/arpie/binary_types.rb', line 14

def from binary, opts
  raise NotImplementedError
end

#required_optsObject



9
10
11
# File 'lib/arpie/binary_types.rb', line 9

def required_opts
  {}
end

#to(object, opts) ⇒ Object

Return [binary]

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/arpie/binary_types.rb', line 19

def to object, opts
  raise NotImplementedError
end