Module: DR::CoreExt::Object

Defined in:
lib/dr/ruby_ext/core_modules.rb

Instance Method Summary collapse

Instance Method Details

#and_this(&b) ⇒ Object

simulate the Maybe monad



297
298
299
# File 'lib/dr/ruby_ext/core_modules.rb', line 297

def and_this(&b)
	nil? ? nil : this(&b)
end

#thisObject

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



292
293
294
295
# File 'lib/dr/ruby_ext/core_modules.rb', line 292

def this
	return yield(self) if block_given?
	return self
end