Class: Halation::Config::Camera

Inherits:
Object
  • Object
show all
Defined in:
lib/halation/config/camera.rb

Overview

A camera profile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yaml) ⇒ Camera

Returns a new instance of Camera.



14
15
16
17
18
19
20
21
22
23
# File 'lib/halation/config/camera.rb', line 14

def initialize(yaml)
  @tag = Coerce.string(yaml["tag"])
  @make = Coerce.string(yaml["make"])
  @model = Coerce.string(yaml["model"])
  @lenses = []

  yaml["lenses"].each do |lens|
    @lenses << Lens.new(lens)
  end
end

Instance Attribute Details

#lensesObject (readonly)

Returns the value of attribute lenses.



12
13
14
# File 'lib/halation/config/camera.rb', line 12

def lenses
  @lenses
end

#makeObject (readonly)

Returns the value of attribute make.



10
11
12
# File 'lib/halation/config/camera.rb', line 10

def make
  @make
end

#modelObject (readonly)

Returns the value of attribute model.



11
12
13
# File 'lib/halation/config/camera.rb', line 11

def model
  @model
end

#tagObject (readonly)

A user-created ID.



9
10
11
# File 'lib/halation/config/camera.rb', line 9

def tag
  @tag
end

Instance Method Details

#to_sString

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/halation/config/camera.rb', line 26

def to_s
  "Camera\n" <<
  [
    "Tag: #{tag}",
    "Make: #{make}",
    "Model: #{model}",
    @lenses.map(&:to_s).join("\n")
  ]
    .join("\n")
    .lines
    .map { |line| "   #{line}" }
    .join
end