Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created April 2, 2020 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AJFaraday/93420a1e3169391dc832af3e2b142b90 to your computer and use it in GitHub Desktop.
Save AJFaraday/93420a1e3169391dc832af3e2b142b90 to your computer and use it in GitHub Desktop.
Overuse of tap? - which is better?
class SomeClass
def do_things
thing_one
thing_two
thing_three
end
def thing_one
do_something
end
def thing_two
do_something
end
def thing_three
do_something
end
end
SomeClass.new.do_things
class SomeClass
def do_things
thing_one.thing_two.thing_three
end
def thing_one
tap do
do_something
end
end
def thing_two
tap do
do_something
end
end
def thing_three
tap do
do_something
end
end
end
SomeClass.new.do_things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment