require"osx/cocoa"includeOSXclassUpdatePastieCookieURL=NSURL.URLWithString("http://pastie.org/")COOKIE_NAME="pasties"defself.withpastie_id# Create a dictionary (hash) to create the new cookie with
new_cookie_values =self.existing_cookie.properties.mutableCopy
# Set our new value
new_cookie_values[NSHTTPCookieValue]=self.existing_cookie.value +"&#{pastie_id}"# Create a new cookie with our attributes
new_cookie =NSHTTPCookie.cookieWithProperties(new_cookie_values)# Set our cookie, overwriting the old one
self.cookieStorage.setCookie(new_cookie)enddefself.existing_cookie@cookie||=self.cookieStorage.cookiesForURL(URL).select {|c| c.name ==COOKIE_NAME}.first
enddefself.cookieStorage@storage||=NSHTTPCookieStorage.sharedHTTPCookieStorage
endend