module Gio::File
Public Class Methods
open(options={}) { |file| ... }
click to toggle source
# File lib/gio2/file.rb, line 20 def open(options={}) arg = options[:arg] cwd = options[:cwd] path = options[:path] uri = options[:uri] if arg if cwd file = new_for_commandline_arg_and_cmd(arg, cwd) else file = new_for_commandline_arg(arg) end elsif path path = path.to_path if path.respond_to?(:to_path) file = new_for_path(path) elsif uri file = new_for_uri(uri) else message = "must specify :arg, :path or :uri: #{options.inspect}" raise ArgumentError, message end if block_given? yield(file) else file end end
Public Instance Methods
read(cancellable=nil) { |input_stream| ... }
click to toggle source
# File lib/gio2/file.rb, line 51 def read(cancellable=nil) input_stream = read_raw(cancellable) return input_stream unless block_given? begin yield(input_stream) ensure input_stream.close unless input_stream.closed? end end
Also aliased as: read_raw