module Gio::File - gio2-3.2.9 Documentation

# 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
        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