Skip to content

Instantly share code, notes, and snippets.

@mikekelly
Created November 26, 2012 22:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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

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

@mikekelly
Copy link
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