Class: GPhoto2::CameraFileInfo Abstract
- Inherits:
-
Object
- Object
- GPhoto2::CameraFileInfo
- Includes:
- FFI::GPhoto2, Struct
- Defined in:
- lib/gphoto2/camera_file_info/camera_file_info.rb
Overview
Direct Known Subclasses
Constant Summary
Constants included from FFI::GPhoto2
FFI::GPhoto2::CameraCaptureType, FFI::GPhoto2::CameraDriverStatus, FFI::GPhoto2::CameraEventType, FFI::GPhoto2::CameraFileAccessType, FFI::GPhoto2::CameraFileInfoFields, FFI::GPhoto2::CameraFileOperation, FFI::GPhoto2::CameraFilePermissions, FFI::GPhoto2::CameraFileStatus, FFI::GPhoto2::CameraFileType, FFI::GPhoto2::CameraFolderOperation, FFI::GPhoto2::CameraOperation, FFI::GPhoto2::CameraWidgetType, FFI::GPhoto2::GphotoDeviceType
Instance Attribute Summary
Attributes included from Struct
Instance Method Summary collapse
-
#fields ⇒ Integer
A bit field of set info fields.
-
#has_field?(field) ⇒ Boolean
return [Boolean] whether the given field is set.
-
#initialize(ptr) ⇒ CameraFileInfo
constructor
A new instance of CameraFileInfo.
-
#size ⇒ Integer?
The size of the file in bytes.
- #status ⇒ CameraFileStatus?
-
#type ⇒ String?
The media type of the file.
Methods included from Struct
Constructor Details
#initialize(ptr) ⇒ CameraFileInfo
Returns a new instance of CameraFileInfo.
8 9 10 |
# File 'lib/gphoto2/camera_file_info/camera_file_info.rb', line 8 def initialize(ptr) @ptr = ptr end |
Instance Method Details
#fields ⇒ Integer
Returns a bit field of set info fields.
13 14 15 16 17 18 19 20 21 |
# 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) ⇒ Boolean
return [Boolean] whether the given field is set
24 25 26 |
# File 'lib/gphoto2/camera_file_info/camera_file_info.rb', line 24 def has_field?(field) (fields & CameraFileInfoFields[field]) != 0 end |
#size ⇒ Integer?
Returns the size of the file in bytes.
34 35 36 |
# File 'lib/gphoto2/camera_file_info/camera_file_info.rb', line 34 def size fetch(:size) end |
#status ⇒ CameraFileStatus?
29 30 31 |
# File 'lib/gphoto2/camera_file_info/camera_file_info.rb', line 29 def status fetch(:status) end |
#type ⇒ String?
Returns the media type of the file.
39 40 41 42 |
# File 'lib/gphoto2/camera_file_info/camera_file_info.rb', line 39 def type type = fetch(:type) type ? type.to_s : nil end |