Sha256: 6c1aac03d8905249be5347b719700da2756258149e5689aae28600c913673afb

Contents?: true

Size: 528 Bytes

Versions: 55

Compression:

Stored size: 528 Bytes

Contents

class NSData

  class << self

    def read_from(path_or_url)
      case path_or_url
      when NSURL
        self.dataWithContentsOfURL(path_or_url)
      when NSString
        self.dataWithContentsOfFile(path_or_url)
      else
        false
      end
    end

  end

  def write_to(path_or_url, atomically=true)
    case path_or_url
    when NSURL
      self.writeToURL(path_or_url, atomically: atomically)
    when NSString
      self.writeToFile(path_or_url, atomically: atomically)
    else
      false
    end
  end

end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
sugarcube-4.0.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.5.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.4.2 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.4.1 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.4.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.7 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.6 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.5 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.4 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.3 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.2 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.1 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.3.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.2.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.1.1 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.1.0 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.0.8 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.0.7 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.0.6 lib/cocoa/sugarcube-files/nsdata.rb
sugarcube-3.0.5 lib/cocoa/sugarcube-files/nsdata.rb