Skip to content

Instantly share code, notes, and snippets.

@chsh
Created August 27, 2009 05:59
Show Gist options
  • Save chsh/176118 to your computer and use it in GitHub Desktop.
Save chsh/176118 to your computer and use it in GitHub Desktop.
class Processor
BLUE_HOSTS = [
'hoge.jp', 'grey.jp', 'hoge.com'
]
def process(lines)
lines.each do |line|
if blue? line
blue_lines << line
else
red_lines << line
end
end
private
def blue?(line)
blue_hosts.each do |blue_host|
return true if line.index(blue_host)
end
false
end
end
Processor.new.process(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment