Skip to content

Instantly share code, notes, and snippets.

@myun2
Last active August 29, 2015 14:06
Show Gist options
  • Save myun2/985b4f2b62045011c3f4 to your computer and use it in GitHub Desktop.
Save myun2/985b4f2b62045011c3f4 to your computer and use it in GitHub Desktop.
Zaru.rb
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