module DR::CoreExt::Object

Public Instance Methods

and_this(&b) click to toggle source

simulate the Maybe monad

# File lib/dr/ruby_ext/core_modules.rb, line 297
def and_this(&b)
        nil? ? nil : this(&b)
end
this() { |self| ... } click to toggle source

in ruby 2.2, 'Object#itself' only returns self

# File lib/dr/ruby_ext/core_modules.rb, line 292
def this
        return yield(self) if block_given?
        return self
end