Sha256: 722096aabad54fb67612b78cf5775b257bb100884e040ab49cea8b5a595073d0

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require 'array_io'
require 'pp'

class InspectArrayIO
	class << self
		def inspect(aio, options={})
			options = {
				:from_start => 100,
				:from_end => 100}.merge(options)
		
			puts "N indexed entries: #{aio.length}"
		
			puts "****************************"
			puts "First #{options[:from_start]} bytes:"
			aio.io.pos = 0
			pp aio.io.read(options[:from_start])
			puts "First entry:"
			puts aio[0]
			
			puts "****************************"
			puts "Last #{options[:from_end]} bytes:"
			aio.io.seek(-options[:from_end], IO::SEEK_END)
			pp aio.io.read(options[:from_end] + 10)
			puts "Last entry:"
			puts aio[-1]
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arrayio-0.1.0 lib/inspect_array_io.rb