Created
December 11, 2008 00:48
-
-
Save laktek/34558 to your computer and use it in GitHub Desktop.
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
#check if at least one child has content - i.e. given a list of booleans, at least one is true? | |
inject(false) { |one_child_has_content, child| one_child_has_content || child.has_content? } | |
#check if all the constraints are true - i.e. given a list of booleans, all of them are true? | |
@constraints.inject(true) { |accepted, constraint| accepted && constraint.check(result) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment