Module: Nyan::Shape
Instance Attribute Summary collapse
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#top ⇒ Object
Returns the value of attribute top.
Instance Method Summary collapse
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom.
3 4 5 |
# File 'lib/nyan/shape.rb', line 3 def bottom @bottom end |
#left ⇒ Object
Returns the value of attribute left.
3 4 5 |
# File 'lib/nyan/shape.rb', line 3 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
3 4 5 |
# File 'lib/nyan/shape.rb', line 3 def right @right end |
#top ⇒ Object
Returns the value of attribute top.
3 4 5 |
# File 'lib/nyan/shape.rb', line 3 def top @top end |
Instance Method Details
#inside?(other_shape) ⇒ Boolean
12 13 14 |
# File 'lib/nyan/shape.rb', line 12 def inside?(other_shape) !outside(other_shape) end |
#outside?(other_shape) ⇒ Boolean
5 6 7 8 9 10 |
# File 'lib/nyan/shape.rb', line 5 def outside?(other_shape) (right < other_shape.left) or (top > other_shape.bottom) or (left > other_shape.right) or (bottom < other_shape.top) end |