lib/bean/nsurl_connection_additions.rb
#
# Helper method for creating a NSURLConnection.
#
# Using this method will cause the URL Connection to use itself
# as the delegate. You can then add error and success handlers to
# be called when the download is finished.
#
# @param req [NSURLRequest] The URL Request
# @param blk [Proc] The success block to hookup
# @return [NSURLConnection] The URL Connection
Helper method for creating a NSURLConnection.
Using this method will cause the URL Connection to use itself
as the delegate. You can then add error and success handlers to
be called when the download is finished.
Helper method for creating a NSURLConnection . Using this method will cause the URL Connection to use itself as the delegate . You can then add error and success handlers to be called when the download is finished .
def initWithRequest(req, &blk)
    @error = nil
    @response = nil
    @on_error = nil
    @on_success = blk
    @data = NSMutableData.data
    initWithRequest(req, delegate:self)
  end
def initWithRequest ( req , & blk ) @error = nil @response = nil @on_error = nil @on_success = blk @data = NSMutableData . data initWithRequest ( req , delegate : self ) end
Helper method for creating a NSURLConnection.
Helper method for creating a NSURLConnection .
The URL Connection
The URL Connection
NSURLConnection
req
The URL Request
The URL Request
blk
The success block to hookup
The success block to hookup