SHARE
TWEET

Untitled

a guest May 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top