Skip to content

Instantly share code, notes, and snippets.

@mikekelly
Created November 26, 2012 22:44
Show Gist options
  • Select an option

  • Save mikekelly/4151159 to your computer and use it in GitHub Desktop.

Select an option

Save mikekelly/4151159 to your computer and use it in GitHub Desktop.
Hactor example
require 'hactor'
class HomeActor
include Hactor::Actor
def on_200(response)
response.follow 'ht:users', actor: UserListActor.new
end
end
class UserListActor
include Hactor::Actor
def on_200(response)
user_links = response.body.links.select { |link| link.rel == 'ht:user' }
user_links.each do |link|
puts "#{link.title} (#{link.href})"
end
end
end
Hactor.start url: 'http://haltalk.herokuapp.com/', actor: HomeActor.new
@steveklabnik

Copy link
Copy Markdown

Neat! The first thing I think of is WebMachine: tried it?

@mikekelly

Copy link
Copy Markdown
Author

@steveklabnik no, I've only looked over it briefly. It's server side though right not client side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment