ruby - How do I override a class method through an instance_eval? -


I have a square Foo with a method bar.

  How can I override the bar of FE with Foo.instance_eval? Def short #do some different end end  

What to override:

  Module ORM square foo def bar # some end and end  < Need to use / pre> 

instance_eval , works with class_eval overrides but do not have context

Assume that you want to change the module so that whenever it is included, your new bar () will be used, you were very close:

  Module ORM Square Foo Def Bar "Old Bar" and End and Larm :: FuClash_Avalde Bar is included in "New Bar" and Class. Lorem Foo.new.bar # = & gt; "New bar" end  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -