raganwald/method-combinators — pull request #15 by ludicast (2012-12-25 18:35:56+00:00)
Title: added actsAs combinator

Okay, this was a fun xmas one while my toddler is napping.

I used your `around` combinator to build an "actsAs" combinator. This assigns roles a la DCI.

So the equivalent of this ruby DCI example:

```ruby
def initialize source_account, destination_account
@source_account = source_account.extend SourceAccount
@destination_account = destination_account.extend DestinationAccount
doStuff...
end
```

is the hotter

```coffeescript
initialize: actsAs(SourceAccount, DestinationAccount) (@sourceAccount, @destinationaccount)->
doStuff...
```

This has the big benefit of removing the role after the method invocation (whereas in the ruby example the modules crash the inheritance party). I named it actAs as an obvious "shout out".