class GPhoto2::CameraFileInfo

@abstract

Public Class Methods

new(ptr) click to toggle source

@param [FFI::GPhoto2::CameraFileInfo] ptr

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 8
def initialize(ptr)
  @ptr = ptr
end

Public Instance Methods

fields() click to toggle source

@return [Integer] a bit field of set info fields

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 13
def fields
  fields = ptr[:fields]

  if fields.is_a?(Symbol)
    CameraFileInfoFields[fields]
  else
    fields
  end
end
has_field?(field) click to toggle source

return [Boolean] whether the given field is set

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 24
def has_field?(field)
  (fields & CameraFileInfoFields[field]) != 0
end
size() click to toggle source

@return [Integer, nil] the size of the file in bytes

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 34
def size
  fetch(:size)
end
status() click to toggle source

@return [CameraFileStatus, nil]

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 29
def status
  fetch(:status)
end
type() click to toggle source

@return [String, nil] the media type of the file

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 39
def type
  type = fetch(:type)
  type ? type.to_s : nil
end

Protected Instance Methods

fetch(key) click to toggle source

param [Symbol] key @return [Object, nil]

# File lib/gphoto2/camera_file_info/camera_file_info.rb, line 48
def fetch(key)
  ptr[key] if has_field?(key)
end