In Files

  • tk/lib/tk/package.rb

Class/Module Index [+]

Quicksearch

TkPackage

Constants

TkCommandNames

Public Instance Methods

add_path(path) click to toggle source
 
               # File tk/lib/tk/package.rb, line 12
def add_path(path)
  Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << path
end
            
forget(package) click to toggle source
 
               # File tk/lib/tk/package.rb, line 16
def forget(package)
  tk_call('package', 'forget', package)
  nil
end
            
if_needed(pkg, ver, *arg, &b) click to toggle source
 
               # File tk/lib/tk/package.rb, line 21
def if_needed(pkg, ver, *arg, &b)
  size = arg.size

  if size==0 && !b
    # proc info
    procedure(tk_call('package', 'ifneeded', pkg, ver))

  elsif size==0 && b
    # set proc
    cmd = proc(&b)
    tk_call('package', 'ifneeded', pkg, ver, cmd)
    cmd

  elsif size==1 && !b
    # set proc
    cmd = arg[0]
    if cmd
      tk_call('package', 'ifneeded', pkg, ver, cmd)
      cmd
    else
      # remove proc
      tk_call('package', 'ifneeded', pkg, ver, '')
      nil
    end

  else
    fail ArgumentError, 'too many arguments'
  end
end
            
names() click to toggle source
 
               # File tk/lib/tk/package.rb, line 51
def names
  tk_split_simplelist(tk_call('package', 'names'))
end
            
prefer(setting = None) click to toggle source
 
               # File tk/lib/tk/package.rb, line 140
def prefer(setting = None)
  tk_call('package', 'prefer', setting)
end
            
present(package, version=None) click to toggle source
 
               # File tk/lib/tk/package.rb, line 66
def present(package, version=None)
  begin
    tk_call('package', 'present', package, version)
  rescue => e
    fail e.class, 'TkPackage ' << e.message
  end
end
            
present_exact(package, version) click to toggle source
 
               # File tk/lib/tk/package.rb, line 74
def present_exact(package, version)
  begin
    tk_call('package', 'present', '-exact', package, version)
  rescue => e
    fail e.class, 'TkPackage ' << e.message
  end
end
            
provide(package, version=nil) click to toggle source
 
               # File tk/lib/tk/package.rb, line 55
def provide(package, version=nil)
  if version
    tk_call('package', 'provide', package, version)
  end
  if (ret = tk_call('package', 'provide', package)) == ''
    nil
  else
    ret
  end
end
            
require(package, version=None) click to toggle source
 
               # File tk/lib/tk/package.rb, line 82
def require(package, version=None)
  begin
    tk_call('package', 'require', package, version)
  rescue => e
    fail e.class, 'TkPackage ' << e.message
  end
end
            
require_exact(package, version) click to toggle source
 
               # File tk/lib/tk/package.rb, line 90
def require_exact(package, version)
  begin
    tk_call('package', 'require', '-exact', package, version)
  rescue => e
    fail e.class, 'TkPackage ' << e.message
  end
end
            
unknown_proc(*arg, &b) click to toggle source
 
               # File tk/lib/tk/package.rb, line 98
def unknown_proc(*arg, &b)
  size = arg.size

  if size==0 && !b
    # proc info
    procedure(tk_call('package', 'unknown'))

  elsif size==0 && b
    # set proc
    cmd = proc(&b)
    tk_call('package', 'unknown', cmd)
    cmd

  elsif size==1 && !b
    # set proc
    cmd = arg[0]
    if cmd
      tk_call('package', 'unknown', cmd)
      cmd
    else
      # remove proc
      tk_call('package', 'unknown', '')
      nil
    end

  else
    fail ArgumentError, 'too many arguments'
  end
end
            
vcompare(version1, version2) click to toggle source
 
               # File tk/lib/tk/package.rb, line 132
def vcompare(version1, version2)
  number(tk_call('package', 'vcompare', version1, version2))
end
            
versions(package) click to toggle source
 
               # File tk/lib/tk/package.rb, line 128
def versions(package)
  tk_split_simplelist(tk_call('package', 'versions', package))
end
            
vsatisfies(version1, version2) click to toggle source
 
               # File tk/lib/tk/package.rb, line 136
def vsatisfies(version1, version2)
  bool(tk_call('package', 'vsatisfies', version1, version2))
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus