I'm trying to monkeypatch the []= method in the Hash class:

Hash.class_eval do
  def []_with_feature=(a,b)
    puts 'foo'
  end
  alias_method_chain :[]=, :feature
end

Something is wrong with the syntax, but I can't figure out what. The
alias_method_chain method does look for punctuation (= in this case)
and expects it to be at the end of the aliased method ([]
_with_feature=), but I get the following syntax error:

SyntaxError: compile error
(irb):5: syntax error, unexpected ')', expecting '='
(irb):7: syntax error, unexpected kEND, expecting ')'
(irb):9: syntax error, unexpected kEND, expecting ')'

Any ideas?

Thanks,
-H
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to