ryanb/cancan — pull request #702 by archan937 (2012-07-27 13:54:02+00:00)
Title: Being able to specify a method name of the ability used for checking abilities (instead of procs)

Currently, it isn't possible to Marshal.dump ability instances with "procced abilities".

```ruby
class Foo
include CanCan::Ability
end

foo = Foo.new
foo.can :read, String, nil do |instance|
# do something
end

Marshal.dump foo
=> TypeError: no marshal_dump is defined for class Proc
```

So instead of providing a proc, I have made it possible to specify a method of the ability instance used for checking abilities.

``` ruby
class Foo
include CanCan::Ability
def evaluate
# do something
end
end

foo = Foo.new
foo.can :read, String, nil, :evaluate

Marshal.dump foo
=> "\x04\bo:\bFoo\x06:\v@rules[\x06o:\x11CanCan::Rule\f:\x0F@match_allF:\x13@base_behaviorT:\r@actions[\x06:\tread:\x0E@subjects[\x06c\vString:\x10@conditions{\x00:\f@method:\revaluate:\r@ability@\x00"
```