Skip to content

Instantly share code, notes, and snippets.

@mrkplt
Created March 29, 2015 13:51
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 mrkplt/c86a8a5c7450d79d5ebb to your computer and use it in GitHub Desktop.
Save mrkplt/c86a8a5c7450d79d5ebb to your computer and use it in GitHub Desktop.
class BadDemeter
# this is an example that abuses LoD. I am not saying that your code
# can't look like this for other reasons.
def thinger
useless_abstraction_three.last
end
private
def useless_abstraction_one
some_array.map(&:foo)
end
def useless_abstraction_two
useless_abstraction_one.map(&:bar)
end
def useless_abstraction_three
useless_abstraction_one.select(&:baz)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment