class Module
Public Instance Methods
===(obj)
click to toggle source
To enable case/when support, reimplement Module#===
so it goes through our method_missing mechanism. See github.com/ruby/ruby/blob/v2_3_0/object.c#L1534
# File lib/abstractivator/lazy.rb, line 88 def ===(obj) obj.is_a?(self) end
type?()
click to toggle source
useful in the following scenario:
things.select(&:Array.type?)
instead of:
things.select { |x| x.is_a?(Array) }
# File lib/abstractivator/module_ext.rb, line 6 def type? proc { |x| x.is_a?(self) } end