Sha256: 2aee66662ab4f8bbe016533155ae10254560809116a6ca4ff419a49293d4c065

Contents?: true

Size: 704 Bytes

Versions: 5

Compression:

Stored size: 704 Bytes

Contents

require "bindata/base_primitive"

module BinData
  # 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"
  #
  class Rest < BinData::BasePrimitive

    register(self.name, self)

    #---------------
    private

    def value_to_binary_string(val)
      val
    end

    def read_and_return_value(io)
      io.read_all_bytes
    end

    def sensible_default
      ""
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bindata-1.1.0 lib/bindata/rest.rb
bindata-1.0.0 lib/bindata/rest.rb
bindata-0.11.1 lib/bindata/rest.rb
bindata-0.11.0 lib/bindata/rest.rb
bindata-0.10.0 lib/bindata/rest.rb