Created
October 30, 2012 18:28
-
-
Save dgtm/3982074 to your computer and use it in GitHub Desktop.
Board Sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Board | |
| #properties | |
| attr_accessor :location | |
| attr_accessor :width | |
| attr_accessor :height | |
| attr_accessor :name | |
| #relationships | |
| attr_accessor :image | |
| attr_accessor :contract | |
| attr_accessor :vendor | |
| def dimensions | |
| @width.to_s + "x" + @height.to_s | |
| end | |
| def current_display | |
| image.url | |
| end | |
| def owner | |
| #contract.current.customer | |
| end | |
| end | |
| class Location | |
| attr_accessor :latitude | |
| attr_accessor :longitude | |
| end | |
| class Image | |
| attr_accessor :url | |
| attr_accessor :location | |
| attr_accessor :version | |
| def is_in_board_proximity? | |
| radius_of(image.location, image.board.location) <= 2.metres | |
| end | |
| end | |
| class Contract | |
| attr_accessor :expires | |
| attr_accessor :customer | |
| end | |
| bpati = Location.new(20,30) | |
| img = Image.new(url: "/") | |
| contract = Contract.new(expires: Date.tomorrow, customer: "Dabur", price: 5) | |
| ba = Board.new(location: bpati, name: "pati") | |
| ba.contract = contract | |
| ba.image = img | |
| bputali = Location.new(200,300) | |
| bu = Board.new(location: bputali, name: "putali") | |
| bu.contract = .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ImagetoPhotoCustomerhas to beClientcustomer/clientwhen instantiatingContract.new, I think passing the client object will be better than string"Dabur". Ain't it?nameforBoardshould becodewidthandheightattribute for board. I'll ask and then get to you on this.