Sha256: c902c7d1091b949fcea2fd7e62c7569178087e1438a4e1091a36b7528be842c6

Contents?: true

Size: 459 Bytes

Versions: 7

Compression:

Stored size: 459 Bytes

Contents

class NSData

  # converts NSData into an NSString using any encoding, default is UTF8
  # @return [NSString]
  def nsstring(encoding=nil)
    if encoding
      NSString.stringWithCString(self.bytes, encoding:encoding)
    else
      NSString.stringWithUTF8String(self.bytes)
    end
  end

  # @return [UIImage]
  def uiimage(scale=nil)
    if scale
      UIImage.imageWithData(self, scale:scale)
    else
      UIImage.imageWithData(self)
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sugarcube-0.13.7 lib/sugarcube/nsdata.rb
sugarcube-0.13.5 lib/sugarcube/nsdata.rb
sugarcube-0.13.4 lib/sugarcube/nsdata.rb
sugarcube-0.13.3 lib/sugarcube/nsdata.rb
sugarcube-0.13.2 lib/sugarcube/nsdata.rb
sugarcube-0.13 lib/sugarcube/nsdata.rb
sugarcube-0.12 lib/sugarcube/nsdata.rb