Last active
August 29, 2015 14:06
-
-
Save myun2/985b4f2b62045011c3f4 to your computer and use it in GitHub Desktop.
Zaru.rb
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
class Zaru | |
@residues = [] | |
attr_reader :hole_size, :residues | |
def initialize(hole_size) | |
@hole_size = hole_size | |
end | |
def put(objects) | |
passes = [] | |
objects.each { |object| | |
(pass_through?(object) ? passes : @residues) << object | |
} | |
passes | |
end | |
def pass_through?(object) | |
object.fluid? || object.size < hole_size | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment