Class: Lensflare::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/lensflare/frame.rb

Overview

class describing frame

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#lensObject

Returns the value of attribute lens.



4
5
6
# File 'lib/lensflare/frame.rb', line 4

def lens
  @lens
end

Instance Method Details

#areaObject



37
38
39
# File 'lib/lensflare/frame.rb', line 37

def area
  width * height
end

#diagonalObject



41
42
43
# File 'lib/lensflare/frame.rb', line 41

def diagonal
  Math.sqrt(width**2 + height**2)
end

#heightObject



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_sObject



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

#widthObject



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