KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why does this not work? module StringRefinement refine String do def bar length end end end using StringRefinement "abcdefghijklmnopqrstuvwxyz".send(:bar) #NoMethodError: undefined method 'bar' for "abcdefghijklmnopqrstuvwxyz":String Can someone explain why send doesn't work here? And is there a way to dynamically call methods defined in a refinement? I can't seem to find a good, full explanation of how refinements work in Ruby 2.0.
Tags (comma-separated)
Save Edits
Cancel