Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Rectangle
- include Model
- attr_accessor :left, :right, :top, :bottom, :width
- def computed_width
- return unless left and right
- right - left
- end
- def effective_width
- width || computed_width
- end
- # ... etc ...
- def effective
- Rectangle.new(
- left: effective_left,
- right: effective_right,
- width: effective_width,
- # ... etc
- )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement