module

GPhoto2::Camera::Configuration

Provides access to camera configuration.

Instance methods

<<(widget : CameraWidget::Base) : self
iso = camera[:iso].as_radio
iso.value = iso.choices.first
camera &lt;&lt; iso
Source
[](key : String | Symbol) : CameraWidget::Base

Returns the attribute identified by key.

See: #config

camera[:whitebalance].to_s  # =&gt; &quot;Automatic&quot;
camera[&quot;whitebalance&quot;].to_s # =&gt; &quot;Automatic&quot;
Source
[]=(key : String | Symbol, value)

Updates the attribute identified by key with the specified value.

This marks the configuration as &quot;dirty&quot;, meaning a call to #save is needed to actually update the configuration on the camera.

camera[&quot;iso&quot;] = 800
camera[&quot;f-number&quot;] = &quot;f/2.8&quot;
camera[&quot;shutterspeed2&quot;] = &quot;1/60&quot;
Source
[]?(key : String | Symbol) : CameraWidget::Base | Nil

Returns the attribute identified by key.

See: #config

camera[:whitebalance].to_s  # =&gt; &quot;Automatic&quot;
camera[&quot;whitebalance&quot;].to_s # =&gt; &quot;Automatic&quot;
Source
config

Returns flattened Hash of camera attributes.

# List camera configuration keys.
camera.config.keys # =&gt; [&quot;autofocusdrive&quot;, &quot;manualfocusdrive&quot;, &quot;controlmode&quot;, ...]

See also: #[] and #[]=

Source
dirty?

Returns true if any attributes have unsaved changes.

camera.dirty? # =&gt; false
camera[:iso] = 400
camera.dirty? # =&gt; true
Source
preserving_config(keys : Enumerable(String | Symbol) | Nil = nil, &) : Nil

Preserves config for a block call.

# Original values
camera[:aperture] # =&gt; 4
camera[:iso]      # =&gt; 400

# Capture photo with different settings,
# while preserving original values
camera.preserving_config do
  1.upto(3) do |i|
    camera.update({
      aperture: 8,
      iso:      200 * i,
    })
    file = camera.capture
    file.save
  end
end

# Original values are being preserved
camera[:aperture] # =&gt; 4
camera[:iso]      # =&gt; 400
Source
reload

Reloads camera configuration.

All unsaved changes will be lost.

camera[:iso] # =&gt; 800
camera[:iso] = 200
camera.reload
camera[:iso] # =&gt; 800
Source
save

Updates the configuration on the camera.

camera[:iso] = 800
camera.save # =&gt; true
camera.save # =&gt; false (nothing to update)
Source
update(attributes) : Bool

Updates camera attributes from the given Hash, NamedTuple or keyword arguments (**kwargs) and saves the configuration.

camera[:iso]           # =&gt; 800
camera[:shutterspeed2] # =&gt; &quot;1/30&quot;

# **kwargs
camera.update(iso: 400, shutterspeed2: &quot;1/60&quot;)
# NamedTuple
camera.update({iso: 400, shutterspeed2: &quot;1/60&quot;})
# Hash
camera.update({&quot;iso&quot; =&gt; 400, &quot;shutterspeed2&quot; =&gt; &quot;1/60&quot;})

camera[:iso]           # =&gt; 400
camera[:shutterspeed2] # =&gt; &quot;1/60&quot;
Source
window

Returns camera root configuration widget.

Source