Class: Arpie::BinaryType
- Inherits:
-
Object
- Object
- Arpie::BinaryType
- Includes:
- Arpie
- Defined in:
- lib/arpie/binary_types.rb
Direct Known Subclasses
BitBinaryType, BytesBinaryType, FixedBinaryType, ListBinaryType, PackBinaryType
Constant Summary
Constants included from Arpie
Instance Method Summary collapse
- #binary_size(opts) ⇒ Object
- #check_limit(value, limit) ⇒ Object
-
#from(binary, opts) ⇒ Object
Return [object, len].
- #required_opts ⇒ Object
-
#to(object, opts) ⇒ Object
Return [binary].
Methods included from Arpie
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]
14 15 16 |
# File 'lib/arpie/binary_types.rb', line 14 def from binary, opts raise NotImplementedError end |
#required_opts ⇒ Object
9 10 11 |
# File 'lib/arpie/binary_types.rb', line 9 def required_opts {} end |
#to(object, opts) ⇒ Object
Return [binary]
19 20 21 |
# File 'lib/arpie/binary_types.rb', line 19 def to object, opts raise NotImplementedError end |