Class: PhotoUtils::Lens

Inherits:
Object
  • Object
show all
Defined in:
lib/photo_utils/lens.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Lens

Returns a new instance of Lens.



11
12
13
14
# File 'lib/photo_utils/lens.rb', line 11

def initialize(params={})
  params.each { |k, v| send("#{k}=", v) }
  @aperture = @max_aperture
end

Instance Attribute Details

#apertureObject

Returns the value of attribute aperture.



9
10
11
# File 'lib/photo_utils/lens.rb', line 9

def aperture
  @aperture
end

#focal_lengthObject

Returns the value of attribute focal_length.



6
7
8
# File 'lib/photo_utils/lens.rb', line 6

def focal_length
  @focal_length
end

#max_apertureObject

Returns the value of attribute max_aperture.



8
9
10
# File 'lib/photo_utils/lens.rb', line 8

def max_aperture
  @max_aperture
end

#min_apertureObject

Returns the value of attribute min_aperture.



7
8
9
# File 'lib/photo_utils/lens.rb', line 7

def min_aperture
  @min_aperture
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/photo_utils/lens.rb', line 5

def name
  @name
end

Instance Method Details

#inspectObject



16
17
18
# File 'lib/photo_utils/lens.rb', line 16

def inspect
  "<#{self.class}: name=#{@name.inspect}, focal_length=#{@focal_length.inspect}, min_aperture=#{@min_aperture.inspect}, max_aperture=#{@max_aperture.inspect}, aperture=#{@aperture.inspect}>"
end

#to_sObject



20
21
22
23
24
25
26
# File 'lib/photo_utils/lens.rb', line 20

def to_s
  if @name
    "#{@name} (#{@focal_length})"
  else
    @focal_length.to_s
  end
end