Class: Lensflare::Frame
- Inherits:
-
Object
- Object
- Lensflare::Frame
- Defined in:
- lib/lensflare/frame.rb
Overview
class describing frame
Instance Attribute Summary collapse
-
#lens ⇒ Object
Returns the value of attribute lens.
Instance Method Summary collapse
- #area ⇒ Object
- #diagonal ⇒ Object
- #height ⇒ Object
- #height=(numeric) ⇒ Object
-
#initialize(width, height) ⇒ Frame
constructor
A new instance of Frame.
- #to_s ⇒ Object
- #width ⇒ Object
- #width=(numeric) ⇒ Object
Constructor Details
#initialize(width, height) ⇒ Frame
Returns a new instance of Frame.
6 7 8 9 |
# File 'lib/lensflare/frame.rb', line 6 def initialize(width, height) self.width = width self.height = height end |
Instance Attribute Details
#lens ⇒ Object
Returns the value of attribute lens.
4 5 6 |
# File 'lib/lensflare/frame.rb', line 4 def lens @lens end |
Instance Method Details
#area ⇒ Object
37 38 39 |
# File 'lib/lensflare/frame.rb', line 37 def area width * height end |
#diagonal ⇒ Object
41 42 43 |
# File 'lib/lensflare/frame.rb', line 41 def diagonal Math.sqrt(width**2 + height**2) end |
#height ⇒ Object
33 34 35 |
# File 'lib/lensflare/frame.rb', line 33 def height @height.to_f end |
#height=(numeric) ⇒ Object
16 17 18 19 |
# File 'lib/lensflare/frame.rb', line 16 def height=(numeric) raise Lensflare::Error::NotANumeric unless numeric.is_a?(Numeric) @height = numeric end |
#to_s ⇒ Object
45 46 47 48 49 |
# File 'lib/lensflare/frame.rb', line 45 def to_s units = Lensflare::UNITS.to_s "width:\n" + width.to_s + units + "\n" + "height:\n" + height.to_s + units + "\n" end |
#width ⇒ Object
29 30 31 |
# File 'lib/lensflare/frame.rb', line 29 def width @width.to_f end |
#width=(numeric) ⇒ Object
11 12 13 14 |
# File 'lib/lensflare/frame.rb', line 11 def width=(numeric) raise Lensflare::Error::NotANumeric unless numeric.is_a?(Numeric) @width = numeric end |