Created
April 9, 2012 00:41
-
-
Save superlou/2340561 to your computer and use it in GitHub Desktop.
Rules
This file contains 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 Rule < ActiveRecord::Base | |
* implements satisfied? | |
* implements message | |
* belongs_to a "ruleable" object (object you can apply a rule, to polymorphic) | |
class RoomMustHaveCapacityRule < Rule | |
* has an integer value "capacity" | |
* satisfied if rule is applied to a Room model who's seating capacity is >= the rule's capacity | |
* message indicates "success" or "failure by [how much]" | |
class RoomMustBeScheduleOnDate < Rule | |
* has an datetime value "date" | |
* satisfied if the rule is applied to a Room model that is booked on date | |
* message indicates "success" or "failure: room must be booked on [date]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment