From: Kent Dahl Date: 2004-06-06T21:33:39+09:00 Subject: Re: How to ducktype a Hash? Nathan Weston wrote: > How about using the fetch and store methods? These work the same as > Hash#[] and Hash#[]=, but are unique to Hash. ObjectSpace.each_object(Module){|m| p m if m.instance_methods.include? "fetch" } Both Hash and Array have fetch, apparently only Hash has store. For other potentially unique candidates: --------------&<-------------- target = Hash methods = target.instance_methods classes = [] ObjectSpace.each_object(Module){|c| classes << c } classes.delete target classes.each{|c| methods -= c.instance_methods } puts methods.size, methods =begin $ ruby unique_interface.rb 15 value? to_hash merge! merge store default default= default_proc invert has_key? each_value update has_value? rehash each_key =end --------------&<-------------- -- (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ ))\_student_/(( \__d L b__/ Master of Science in Technology ) ( \__\_�|�_/__/ ) _) Industrial economics and technology management ( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)