Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class Rectangle
  2. include Model
  3.  
  4. attr_accessor :left, :right, :top, :bottom, :width
  5.  
  6. def computed_width
  7. return unless left and right
  8. right - left
  9. end
  10.  
  11. def effective_width
  12. width || computed_width
  13. end
  14.  
  15. # ... etc ...
  16.  
  17. def effective
  18. Rectangle.new(
  19. left: effective_left,
  20. right: effective_right,
  21. width: effective_width,
  22. # ... etc
  23. )
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement