Class: FormatParser::EXIFParser::IOExt

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/parsers/exif_parser.rb

Overview

EXIFR kindly requests the presence of a few more methods than what our IOConstraint is willing to provide, but they can be derived from the available ones

Instance Method Summary collapse

Instance Method Details

#readbyteObject Also known as: getbyte



10
11
12
13
14
# File 'lib/parsers/exif_parser.rb', line 10

def readbyte
  if byte = read(1)
    byte.unpack('C').first
  end
end

#seek(n, seek_mode = IO::SEEK_SET) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/parsers/exif_parser.rb', line 16

def seek(n, seek_mode = IO::SEEK_SET)
  io = __getobj__
  case seek_mode
  when IO::SEEK_SET
    io.seek(n)
  when IO::SEEK_CUR
    io.seek(io.pos + n)
  when IO::SEEK_END
    io.seek(io.size + n)
  else
    raise Errno::EINVAL
  end
end