Class: FormatParser::EXIFParser::EXIFResult

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

Instance Method Summary collapse

Instance Method Details

#orientationObject



54
55
56
57
58
59
60
# File 'lib/parsers/exif_parser.rb', line 54

def orientation
  # In some EXIF tags the value type is set oddly - it unpacks into multiple values,
  # and it will look like this: [#<EXIFR::TIFF::Orientation:TopLeft(1)>, nil]
  orientation_values = Array(__getobj__.orientation)
  last_usable_value = orientation_values.compact[-1] # Use the last non-nil one
  last_usable_value.to_i
end

#orientation_symObject



62
63
64
# File 'lib/parsers/exif_parser.rb', line 62

def orientation_sym
  ORIENTATIONS.fetch(orientation)
end

#rotated?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/parsers/exif_parser.rb', line 44

def rotated?
  orientation.to_i > 4
end

#to_json(*maybe_coder) ⇒ Object



48
49
50
51
52
# File 'lib/parsers/exif_parser.rb', line 48

def to_json(*maybe_coder)
  hash_representation = __getobj__.to_hash
  sanitized = FormatParser::AttributesJSON._sanitize_json_value(hash_representation)
  sanitized.to_json(*maybe_coder)
end