Displaying 1 result from an estimated 1 matches for "orig_load_f".
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists,
I am a bit stumped here. I want to extend the ''load_file'' method in the
YAML module. Following along with the PickAxe example of making old
methods do new things, I try this in irb:
>> module YAML
>> alias_method :orig_load_f, :load_file
>> def load_file(*args)
>> contents = orig_load_f(*args)
>> contents.symbolize_keys.each_value {|v| v.symbolize_keys }
>> end
>> end
But after that last ''end'', irb explodes, saying:
NameError: undefined method `load_file'...