Sha256: 30d3ba59248768b051ce4d147a820e01693ae42a29641840dae07fba128ebcc8

Contents?: true

Size: 460 Bytes

Versions: 5

Compression:

Stored size: 460 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

5 entries across 5 versions & 1 rubygems

Version Path
sugarcube-0.16 lib/sugarcube/nsdata.rb
sugarcube-0.15.5 lib/sugarcube/nsdata.rb
sugarcube-0.15.3 lib/sugarcube/nsdata.rb
sugarcube-0.15.0 lib/sugarcube/nsdata.rb
sugarcube-0.14.0 lib/sugarcube/nsdata.rb