Class: PolymorphicShape::Square

Inherits:
Shape
  • Object
show all
Defined in:
lib/shape/polymorphic_shape/square.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(side) ⇒ Square

Returns a new instance of Square.



4
5
6
# File 'lib/shape/polymorphic_shape/square.rb', line 4

def initialize(side)
  @side = side
end

Instance Attribute Details

#sideObject

Returns the value of attribute side.



3
4
5
# File 'lib/shape/polymorphic_shape/square.rb', line 3

def side
  @side
end

Instance Method Details

#areaObject



8
9
10
# File 'lib/shape/polymorphic_shape/square.rb', line 8

def area
  @side * @side
end