class BinData::Rest

Rest will consume the input stream from the current position to the end of the stream. This will mainly be useful for debugging and developing.

require 'bindata'

class A < BinData::Record
  string :a, read_length: 5
  rest   :rest
end

obj = A.read("abcdefghij")
obj.a #=> "abcde"
obj.rest #=" "fghij"

Private Instance Methods

read_and_return_value(io) click to toggle source
# File lib/bindata/rest.rb, line 26
def read_and_return_value(io)
  io.read_all_bytes
end
sensible_default() click to toggle source
# File lib/bindata/rest.rb, line 30
def sensible_default
  ""
end
value_to_binary_string(val) click to toggle source
# File lib/bindata/rest.rb, line 22
def value_to_binary_string(val)
  val
end