Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract ForEachLine into its own file
- Loading branch information
1 parent
60316b3
commit 87b61a9
Showing
3 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |