File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ cameras.each do |camera|
9
9
puts camera.model.colorize(:green )
10
10
props = {
11
11
" id" : camera.id,
12
+ " serial number" : camera.serialnumber,
12
13
" port" : camera.port,
13
14
" driver status" : abilities.status,
14
15
" device type" : abilities.device_type,
Original file line number Diff line number Diff line change @@ -5,13 +5,16 @@ module GPhoto2
5
5
module ID
6
6
UUID_NS = UUID .new(" cc4daadf-37f5-4a30-8f1b-33a49a08e012" )
7
7
8
+ # Returns the serial number of the camera if present.
9
+ def serialnumber : String ?
10
+ self [:serialnumber ]?.try(& .value?).try(& .to_s)
11
+ end
12
+
8
13
# Returns the ID of the camera.
9
14
#
10
15
# WARNING: this ID is not guaranteed to be unique.
11
16
getter id : UUID do
12
- sn = self [:serialnumber ]?.try(& .value?)
13
- id = " #{ model } -#{ sn || port } "
14
-
17
+ id = " #{ model } -#{ serialnumber || port } "
15
18
UUID .v5(id, UUID_NS )
16
19
end
17
20
end
You can’t perform that action at this time.
0 commit comments