Module: Pulo::Figure2D

Includes:
Quantity_Checker
Included in:
Circle, Rectangle, Square, Trapezoid, Triangle
Defined in:
lib/pulo/figure/figure2d.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Quantity_Checker

#quantity_check

Instance Attribute Details

#areaObject (readonly)

Returns the value of attribute area.



6
7
8
# File 'lib/pulo/figure/figure2d.rb', line 6

def area
  @area
end

#perimeterObject (readonly)

Returns the value of attribute perimeter.



6
7
8
# File 'lib/pulo/figure/figure2d.rb', line 6

def perimeter
  @perimeter
end

Instance Method Details

#*(other) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/pulo/figure/figure2d.rb', line 7

def * (other)
  if other.is_a?(Length)
    raise "No extrusion figure known for #{self.class}" unless self.respond_to?(:extrusion_figure)
    self.extrusion_figure.new(face: self, length: other)
  else
    raise "Dont know how to multiply a #{self.class} by a #{other.class}"
  end
end