Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- # vim:set fileencoding=utf-8 filetype=ruby
- #
- # dummy ActiveResouce server with WEBrick
- #
- $KCODE = 'u'
- require 'rubygems'
- require 'activesupport'
- require 'webrick/httpserver'
- s = WEBrick::HTTPServer.new(:Port=>10080)
- trap("INT"){s.shutdown}
- s.mount_proc("/todos.xml") do |req, res|
- res.content_type = "text/xml"
- res.body = [
- {:id=>1, :title=>"the work", :description=>"work, work, work"},
- {:id=>2, :title=>"wash dish", :description=>"keep my family peace"},
- ].to_xml(:root=>"todos", :children=>"todo")
- end
- s.start
Add Comment
Please, Sign In to add comment