Skip to content

Commit

Permalink
Extract ForEachLine into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwellman committed Feb 20, 2014
1 parent 60316b3 commit 87b61a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/bane.rb
@@ -1,5 +1,6 @@
require 'bane/extensions'
require 'bane/service_maker'
require 'bane/behaviors/for_each_line'
require 'bane/behaviors/behaviors'
require 'bane/behaviors/exported'
require 'bane/services/behavior_server'
Expand Down
11 changes: 0 additions & 11 deletions lib/bane/behaviors/behaviors.rb
Expand Up @@ -2,17 +2,6 @@ module Bane

module Behaviors

# This module can be used to wrap another behavior with
# a "while(io.gets)" loop, which reads a line from the input and
# then performs the given behavior.
module ForEachLine
def serve(io)
while (io.gets)
super(io)
end
end
end

# Closes the connection immediately after a connection is made.
class CloseImmediately
def serve(io)
Expand Down
16 changes: 16 additions & 0 deletions lib/bane/behaviors/for_each_line.rb
@@ -0,0 +1,16 @@
module Bane
module Behaviors

# This module can be used to wrap another behavior with
# a "while(io.gets)" loop, which reads a line from the input and
# then performs the given behavior.
module ForEachLine
def serve(io)
while (io.gets)
super(io)
end
end
end

end
end

0 comments on commit 87b61a9

Please sign in to comment.