Module: Exif::Utils::Decode::Motorola

Defined in:
lib/exifparser/utils.rb

Instance Method Summary collapse

Instance Method Details

#byte_orderObject



21
22
23
# File 'lib/exifparser/utils.rb', line 21

def byte_order
  :motorola
end

#decode_slong(str) ⇒ Object



41
42
43
# File 'lib/exifparser/utils.rb', line 41

def decode_slong(str)
  str[0,4].unpack('N').pack('l').unpack('l').first
end

#decode_sshort(str) ⇒ Object



37
38
39
# File 'lib/exifparser/utils.rb', line 37

def decode_sshort(str)
  str[0,2].unpack('n').pack('s').unpack('s').first
end

#decode_ubytes(str) ⇒ Object



25
26
27
# File 'lib/exifparser/utils.rb', line 25

def decode_ubytes(str)
  str.unpack('C*')
end

#decode_ulong(str) ⇒ Object



33
34
35
# File 'lib/exifparser/utils.rb', line 33

def decode_ulong(str)
  str[0,4].unpack('N').first
end

#decode_ushort(str) ⇒ Object



29
30
31
# File 'lib/exifparser/utils.rb', line 29

def decode_ushort(str)
  str[0,2].unpack('n').first
end

#parseTagID(str) ⇒ Object



45
46
47
# File 'lib/exifparser/utils.rb', line 45

def parseTagID(str)
  sprintf("0x%02x%02x", *(str.unpack("C*")))
end