to ruby
This is bookmarklet to generate a Ruby API for submitting a form on a
given website. The idea is that when you're on a certain site, and
click this link, it generates a Ruby class for submitting a
(usually POST) request to that site. For example, if you
were looking at the Hopstop site (as I find myself doing a lot) and
click this link after dragging it to your toolbar
toruby
You would see this,
which is a Ruby class that provides the accessors, enums from select elements, an initializer,
and a method process taking the text inputs, so that you could automate making
requests to this site now with code like the following, assuming you put this in hopstop.rb:
require 'hopstop' html = Hopstop.new.process '123 14th st', '321 41st st'
The original Javascript source is here
toruby.js
and compressed (with this) version is here
out.js
You may have to tweek the output a little, but it saves time, and was fun to write.


