Created
March 13, 2012 14:01
-
-
Save nthx/2028946 to your computer and use it in GitHub Desktop.
god_systems_god_1
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 Ebay | |
constructor: -> | |
#I'm yet to decide if static vs dynamic roles' assignment | |
#is better. It doesn't matter so much for now | |
#extend(@, EbayCanBeWatchedRole) | |
#extend(@, SellersCanListRole) | |
class EbayCanBeWatchedRole | |
is_already_watching_item: (seller, item) => | |
storage().is_seller_watching(item) | |
seller_wants_to_watch_item: (seller, item) => | |
if @is_already_watching_item(seller, item) | |
throw new AlreadyWatching() | |
storage().seller_starts_watching(item) | |
class ListingItemAnswer | |
listing_is_valid: () => | |
errors: () => | |
mark_ok: () => | |
class SellersCanListRole | |
list_items: (seller, item_definition) => | |
answer = new ListingItemAnswer() | |
if @is_valid(item_definition) and @can_seller_list(seller) | |
@schedule_for_listing(seller, item_definition) | |
answer.mark_ok() | |
#... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment