1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/lib/tkmacpkg.rb
nagai fd46a1da0a process.c : unify indentation
configure.in : add --enable-setreuid option
tcltklib.c : TclTkIp.new accepts 'ip-name' and 'options'
             ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
tk.rb      : support arguments of TclTkIp.new
             ( see TkCore::IP_NAME, TkCore::IP_OPTS )
tk*.rb     : preparations for multi-Tk interpreter support


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-23 16:07:35 +00:00

56 lines
1.3 KiB
Ruby

#
# tkmacpkg.rb : methods for Tcl/Tk packages for Macintosh
# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
#
# ATTENTION !!
# This is NOT TESTED. Because I have no test-environment.
#
#
require 'tk'
module TkMacResource
extend Tk
extend TkMacResource
TkCommandNames = ['resource'.freeze].freeze
tk_call('package', 'require', 'resource')
def close(rsrcRef)
tk_call('resource', 'close', rsrcRef)
end
def delete(rsrcType, opts=nil)
tk_call('resource', 'delete', *(hash_kv(opts) + rsrcType))
end
def files(rsrcRef=nil)
if rsrcRef
tk_call('resource', 'files', rsrcRef)
else
tk_split_simplelist(tk_call('resource', 'files'))
end
end
def list(rsrcType, rsrcRef=nil)
tk_split_simplelist(tk_call('resource', 'list', rsrcType, rsrcRef))
end
def open(fname, access=nil)
tk_call('resource', 'open', fname, access)
end
def read(rsrcType, rsrcID, rsrcRef=nil)
tk_call('resource', 'read', rsrcType, rsrcID, rsrcRef)
end
def types(rsrcRef=nil)
tk_split_simplelist(tk_call('resource', 'types', rsrcRef))
end
def write(rsrcType, data, opts=nil)
tk_call('resource', 'write', *(hash_kv(opts) + rsrcType + data))
end
module_function :close, :delete, :files, :list, :open, :read, :types, :write
end