Class: PhotoUtils::Lens
- Inherits:
-
Object
- Object
- PhotoUtils::Lens
- Defined in:
- lib/photo_utils/lens.rb
Instance Attribute Summary collapse
-
#aperture ⇒ Object
Returns the value of attribute aperture.
-
#focal_length ⇒ Object
Returns the value of attribute focal_length.
-
#max_aperture ⇒ Object
Returns the value of attribute max_aperture.
-
#min_aperture ⇒ Object
Returns the value of attribute min_aperture.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Lens
constructor
A new instance of Lens.
- #inspect ⇒ Object
- #to_s ⇒ Object
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
#aperture ⇒ Object
Returns the value of attribute aperture.
9 10 11 |
# File 'lib/photo_utils/lens.rb', line 9 def aperture @aperture end |
#focal_length ⇒ Object
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_aperture ⇒ Object
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_aperture ⇒ Object
Returns the value of attribute min_aperture.
7 8 9 |
# File 'lib/photo_utils/lens.rb', line 7 def min_aperture @min_aperture end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/photo_utils/lens.rb', line 5 def name @name end |
Instance Method Details
#inspect ⇒ Object
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_s ⇒ Object
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 |