In my case i have 4 methods that return nil, so explicit definition looks wierd for me. So that why i thought maybe such method will useful, at least to make code cleaner
def method1; nil; end
def method2; nil; end vs define_methods :method1, :method2, :method3, :method4
def method3; nil; end
def method4; nil; end
Четвер, 4 жовтня 2012 р. 14:35:50 UTC+3 користувач Robert Pankowecki написав:
Thanks for your proposal, but it’s probably too narrow use case to extend rails with it.
Also, it may look weird to do a few similar methods that just return nil, but at least it’s easy to understand - if I don’t know what does define_methods do, I would need to check implementation or documentation to understand this.
In such case I think even such code would be better: