Source

atlassian-jruby-example-plugin / src / main / ruby / rurl.rb

Full commit
require 'rubygems'
require 'open-uri'
require 'java'

class RurlResponse
  include Java::com.atlassian.plugins.polyglot.jrubyexample.servlet.HttpResponseInformation
  attr_accessor :http_headers, :body_lines
  def initialize(http_headers, body_lines)
    @http_headers, @body_lines = http_headers, body_lines
  end
end

class Rurl
  def curl(url)
    open(url) do |f|
      RurlResponse.new(f.meta, f.each_line.to_a[1..16])
    end
  end
end