Created
February 4, 2016 02:23
-
-
Save egardner/639cfb81238490716b43 to your computer and use it in GitHub Desktop.
Assignment Branch Condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Catalogue Sections | |
# Returns 3 arrays of resource objects (frontmatter, catalogue, backmatter) | |
def catalogue_sections | |
contents = sort_catalogue_contents | |
frontmatter = contents.find_all { |p| p.data.sort_order <= 10 } | |
backmatter = contents.find_all { |p| p.data.sort_order > 100 } | |
catalogue = contents.find_all do |p| | |
p.data.sort_order > 10 && p.data.sort_order <= 100 | |
end | |
frontmatter.sort_by! { |p| p.data.sort_order } | |
catalogue.sort_by! { |p| p.data.sort_order } | |
backmatter.sort_by! { |p| p.data.sort_order } | |
return frontmatter, catalogue, backmatter | |
end |
It means that your method is too big, that it's doing too much. In this case one could argue that it contains too much duplication.
A bit computer sciency, but here's the definition: http://c2.com/cgi/wiki?AbcMetric
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm writing a Helper Method in the Middleman static site generator.
I've started using Rubocop in an attempt to write higher-quality code, and I keep getting the following warning:
Can anyone explain (in non-computer science jargon) what this actually means?