geeksoflondon/hamster — pull request #83 by cbetta (2013-06-02 16:13:53+00:00)
Title: Interactable helpers

Some handy helpers

```ruby
class Ticket
include Interactable

...

end

#class methods
Ticket.get_all("foo", "bar") # gets all Tickets associated to interactions with key "foo" and value "bar"
Ticket.get("foo", "bar") # gets most recent Ticket associated to interaction with key "foo" and value "bar"
Ticket.interactions("foo", "bar") # gets all interactions associated Tickets with key "foo" and value "bar"
Ticket.interaction("foo", "bar") # gets the most recent interaction associated to a Ticket with key "foo" and value "bar"

# instance methods
ticket.is_foo? # returns if current interaction with key foo is true
ticket.has_foo? # checks if interaction with key foo has ever been set
ticket.is_foo! # sets interaction with key foo to true
ticket.isnt_foo! # sets interaction with key foo to false

ticket.is "foo" # same as is_foo!
ticket.isnt "foo" # same as isnt_foo!
ticket.has "foo", "bar" # sets interaction with key foo and value bar
ticket.get "foo" # gets the value for the current interaction with key foo
```