Class: GPhoto2::CameraFile
Constant Summary
collapse
- PREVIEW_FILENAME =
The preview data is assumed to be a jpg.
'capture_preview.jpg'.freeze
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 collapse
Attributes included from Struct
#ptr
Instance Method Summary
collapse
Methods included from Struct
#to_ptr
Constructor Details
#initialize(camera, folder = nil, name = nil) ⇒ CameraFile
Returns a new instance of CameraFile.
18
19
20
21
22
|
# File 'lib/gphoto2/camera_file.rb', line 18
def initialize(camera, folder = nil, name = nil)
@camera = camera
@folder, @name = folder, name
new
end
|
Instance Attribute Details
#folder ⇒ String
10
11
12
|
# File 'lib/gphoto2/camera_file.rb', line 10
def folder
@folder
end
|
#name ⇒ String
13
14
15
|
# File 'lib/gphoto2/camera_file.rb', line 13
def name
@name
end
|
Instance Method Details
#data ⇒ String
41
42
43
|
# File 'lib/gphoto2/camera_file.rb', line 41
def data
data_and_size.first
end
|
#delete ⇒ void
This method returns an undefined value.
36
37
38
|
# File 'lib/gphoto2/camera_file.rb', line 36
def delete
@camera.delete(self)
end
|
51
52
53
|
# File 'lib/gphoto2/camera_file.rb', line 51
def info
preview? ? nil : get_info
end
|
#preview? ⇒ Boolean
25
26
27
|
# File 'lib/gphoto2/camera_file.rb', line 25
def preview?
@folder.nil? && @name.nil?
end
|
#save(pathname = default_filename) ⇒ Integer
Returns the number of bytes written.
31
32
33
|
# File 'lib/gphoto2/camera_file.rb', line 31
def save(pathname = default_filename)
File.binwrite(pathname, data)
end
|
#size ⇒ Integer
46
47
48
|
# File 'lib/gphoto2/camera_file.rb', line 46
def size
data_and_size.last
end
|