Module: TkPackage
Constant Summary
collapse
- TkCommandNames =
['package'.freeze].freeze
Constants included
from TkCore
TkCore::EventFlag, TkCore::INTERP, TkCore::INTERP_MUTEX, TkCore::INTERP_ROOT_CHECK, TkCore::INTERP_THREAD, TkCore::INTERP_THREAD_STATUS, TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD, TkCore::WIDGET_DESTROY_HOOK, TkCore::WITH_ENCODING, TkCore::WITH_RUBY_VM
Constants included
from TkComm
TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames
Constants included
from TkUtil
TkUtil::None, TkUtil::RELEASE_DATE
Instance Method Summary
collapse
-
#add_path(path) ⇒ Object
-
#forget(package) ⇒ Object
-
#if_needed(pkg, ver, *arg, &b) ⇒ Object
-
#names ⇒ Object
-
#prefer(setting = None) ⇒ Object
-
#present(package, version = None) ⇒ Object
-
#present_exact(package, version) ⇒ Object
-
#provide(package, version = nil) ⇒ Object
-
#require(package, version = None) ⇒ Object
-
#require_exact(package, version) ⇒ Object
-
#unknown_proc(*arg, &b) ⇒ Object
-
#vcompare(version1, version2) ⇒ Object
-
#versions(package) ⇒ Object
-
#vsatisfies(version1, version2) ⇒ Object
Methods included from TkCore
#_tk_call_to_list_core, #after, #after_cancel, #after_idle, #appname, #appsend, #appsend_deny, #appsend_displayof, callback, #callback_break, #callback_continue, #callback_return, #chooseColor, #chooseDirectory, #do_one_event, #event_generate, #getMultipleOpenFile, #getMultipleSaveFile, #getOpenFile, #getSaveFile, #get_eventloop_tick, #get_eventloop_weight, #get_no_event_wait, #inactive, #inactive_displayof, #info, #ip_eval, #ip_eval_with_enc, #ip_eval_without_enc, #ip_invoke, #ip_invoke_with_enc, #ip_invoke_without_enc, #is_mainloop?, #load_cmd_on_ip, #mainloop, #mainloop_exist?, #mainloop_thread?, #mainloop_watchdog, #messageBox, #rb_appsend, #rb_appsend_displayof, #reset_inactive, #reset_inactive_displayof, #restart, #scaling, #scaling_displayof, #set_eventloop_tick, #set_eventloop_weight, #set_no_event_wait, #tk_call, #tk_call_to_list, #tk_call_to_list_with_enc, #tk_call_to_list_without_enc, #tk_call_to_simplelist, #tk_call_to_simplelist_with_enc, #tk_call_to_simplelist_without_enc, #tk_call_with_enc, #tk_call_without_enc, #windowingsystem
Methods included from TkComm
_at, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #bindinfo_all, bool, image_obj, install_cmd, #install_cmd, list, num_or_str, number, procedure, simplelist, string, #subst, tk_tcl2ruby, uninstall_cmd, #uninstall_cmd, window
Methods included from TkUtil
_conv_args, #_conv_args, #_fromUTF8, _get_eval_enc_str, #_get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd
Methods included from TkEvent
#install_bind, #install_bind_for_event_class
Instance Method Details
#add_path(path) ⇒ Object
12
13
14
|
# File 'ext/lib/tk/package.rb', line 12
def add_path(path)
Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << path
end
|
#forget(package) ⇒ Object
16
17
18
19
|
# File 'ext/lib/tk/package.rb', line 16
def forget(package)
tk_call('package', 'forget', package)
nil
end
|
#if_needed(pkg, ver, *arg, &b) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'ext/lib/tk/package.rb', line 21
def if_needed(pkg, ver, *arg, &b)
size = arg.size
if size==0 && !b
procedure(tk_call('package', 'ifneeded', pkg, ver))
elsif size==0 && b
cmd = proc(&b)
tk_call('package', 'ifneeded', pkg, ver, cmd)
cmd
elsif size==1 && !b
cmd = arg[0]
if cmd
tk_call('package', 'ifneeded', pkg, ver, cmd)
cmd
else
tk_call('package', 'ifneeded', pkg, ver, '')
nil
end
else
fail ArgumentError, 'too many arguments'
end
end
|
51
52
53
|
# File 'ext/lib/tk/package.rb', line 51
def names
tk_split_simplelist(tk_call('package', 'names'))
end
|
#prefer(setting = None) ⇒ Object
140
141
142
|
# File 'ext/lib/tk/package.rb', line 140
def prefer(setting = None)
tk_call('package', 'prefer', setting)
end
|
#present(package, version = None) ⇒ Object
66
67
68
69
70
71
72
|
# File 'ext/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) ⇒ Object
74
75
76
77
78
79
80
|
# File 'ext/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) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'ext/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) ⇒ Object
82
83
84
85
86
87
88
|
# File 'ext/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) ⇒ Object
90
91
92
93
94
95
96
|
# File 'ext/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) ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'ext/lib/tk/package.rb', line 98
def unknown_proc(*arg, &b)
size = arg.size
if size==0 && !b
procedure(tk_call('package', 'unknown'))
elsif size==0 && b
cmd = proc(&b)
tk_call('package', 'unknown', cmd)
cmd
elsif size==1 && !b
cmd = arg[0]
if cmd
tk_call('package', 'unknown', cmd)
cmd
else
tk_call('package', 'unknown', '')
nil
end
else
fail ArgumentError, 'too many arguments'
end
end
|
#vcompare(version1, version2) ⇒ Object
132
133
134
|
# File 'ext/lib/tk/package.rb', line 132
def vcompare(version1, version2)
number(tk_call('package', 'vcompare', version1, version2))
end
|
#versions(package) ⇒ Object
128
129
130
|
# File 'ext/lib/tk/package.rb', line 128
def versions(package)
tk_split_simplelist(tk_call('package', 'versions', package))
end
|
#vsatisfies(version1, version2) ⇒ Object
136
137
138
|
# File 'ext/lib/tk/package.rb', line 136
def vsatisfies(version1, version2)
bool(tk_call('package', 'vsatisfies', version1, version2))
end
|