Skip to content

Instantly share code, notes, and snippets.

@dgtm
Created October 30, 2012 18:28
Show Gist options
  • Select an option

  • Save dgtm/3982074 to your computer and use it in GitHub Desktop.

Select an option

Save dgtm/3982074 to your computer and use it in GitHub Desktop.
Board Sketch
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 = ....
@millisami
Copy link

  1. Lets change the name of class Image to Photo
  2. Customer has to be Client
  3. Passing customer/client when instantiating Contract.new, I think passing the client object will be better than string "Dabur". Ain't it?
  4. I think the attribute name name for Board should be code
  5. I'm not sure whether we need to have the width and height attribute for board. I'll ask and then get to you on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment