module Augmented::Objects::Thru
Public Instance Methods
thru(&function)
click to toggle source
as seen on lodash: lodash.com/docs#thru
# File lib/augmented/objects/thru.rb, line 7 def thru &function (function || :itself.to_proc).call self end
thru_if(condition, &function)
click to toggle source
# File lib/augmented/objects/thru.rb, line 11 def thru_if condition, &function apply_function = condition.respond_to?(:call) ? condition.call(self) : condition apply_function ? self.thru(&function) : self end
thru_unless(condition, &function)
click to toggle source
# File lib/augmented/objects/thru.rb, line 16 def thru_unless condition, &function skip_function = condition.respond_to?(:call) ? condition.call(self) : condition skip_function ? self : self.thru(&function) end