Created
May 28, 2011 19:46
-
-
Save nicholasjhenry/997153 to your computer and use it in GitHub Desktop.
DCI Example
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 CheckoutController | |
| def new | |
| checkout = ChecktoutContext.new | |
| @order = checkout.order | |
| end | |
| end | |
| class CheckoutContext | |
| def initialize | |
| @order = Order.new | |
| @order.send(:include, CheckoutRole) | |
| end | |
| end | |
| module CheckoutRole | |
| # methods related to checkout | |
| extend ActiveSupport::Concern | |
| module InstanceMethods | |
| def finalize! | |
| # ... | |
| end | |
| end | |
| end | |
| class Order | |
| # ... | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment