summaryrefslogtreecommitdiffstats
path: root/ext/tk/sample
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-01 07:42:37 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-01 07:42:37 +0000
commit730726c4af6b403bbdbcabd0025eb8fa877c6a1d (patch)
tree7ac8218ba61698b2ac1b60fbd09cbf3b2879fe16 /ext/tk/sample
parent89f48efbb2cfaa40e3b819021c5ac7a1c3b83a5e (diff)
downloadruby-730726c4af6b403bbdbcabd0025eb8fa877c6a1d.tar.gz
ruby-730726c4af6b403bbdbcabd0025eb8fa877c6a1d.tar.xz
ruby-730726c4af6b403bbdbcabd0025eb8fa877c6a1d.zip
* ext/tk/ChangeLog.tkextlib: add log of the modification by
ocean <ocean@ruby-lang.org>. * ext/tk/sample/tkextlib/treectrl/demo.rb: bridge the gap of Hash#index or Hash#key between ruby 1.8 and 1.9 git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample')
-rw-r--r--ext/tk/sample/tkextlib/treectrl/demo.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb
index 892b5a62c..aaa6b2612 100644
--- a/ext/tk/sample/tkextlib/treectrl/demo.rb
+++ b/ext/tk/sample/tkextlib/treectrl/demo.rb
@@ -7,8 +7,14 @@ $ScriptDir = File.dirname(File.expand_path(__FILE__))
$HasColumnCreate = Tk::TreeCtrl::HasColumnCreateCommand
-class Hash
- alias key index
+if Hash.instance_methods.include?('key')
+ # probably ruby 1.9.x --> use Hash#key
+ # Because Hash#index show warning "Hash#index is deprecated; use Hash#key".
+else
+ # probably ruby 1.8.x --> use Hash#index
+ class Hash
+ alias key index
+ end
end
class TkTreeCtrl_demo