diff options
Diffstat (limited to 'ext/tk/sample/tkextlib/treectrl')
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/demo.rb | 10 |
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 892b5a62c7..aaa6b2612b 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 |