On Wed, Aug 4, 2021 at 7:35 AM Billy Zheng <[email protected]> wrote: > I write a gem use the code from `sequel/extensions/blank`, when i reading > following code, i don't understand why we need run `alias_method` like > following? > > ```rb > [FalseClass, Object, NilClass, Numeric, String, TrueClass].each do |klass| > # :nocov: > if klass.method_defined?(:blank?) > klass.send(:alias_method, :blank?, :blank?) > end > # :nocov: > end > ``` >
This self-aliasing is done to avoid warning messages in verbose warning mode if an existing blank? method is already defined. It's the officially recommended way of avoiding the warning messages. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CADGZSSfBD6vaC_yKqVL6%2Bn_HRD_cxBXp0SMiPpKxpoXtSdd0Xw%40mail.gmail.com.
