Define Object#as
:
class Object
def as
yield self
end
end
And now you can write:
def not_sure_this_is_nice_enough_method1
something_complex(a, b, c).as do |obj|
a_predicate_check? ? obj.one_more_method_call : obj
end
end
Define Object#as
:
class Object
def as
yield self
end
end
And now you can write:
def not_sure_this_is_nice_enough_method1
something_complex(a, b, c).as do |obj|
a_predicate_check? ? obj.one_more_method_call : obj
end
end