Skip to content

Commit

Permalink
Simplified file read example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimweirich committed Sep 13, 2010
1 parent 28eec8c commit 0c18e97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/about_iteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def test_all_iteration_methods_work_on_any_collection_not_just_arrays
assert_equal __([11, 12, 13]), result

# Files act like a collection of lines
upcase_lines = File.open("example_file.txt") do |file|
file.map { |line| line.strip.upcase }
File.open("example_file.txt") do |file|
upcase_lines = file.map { |line| line.strip.upcase }
assert_equal __(["THIS", "IS", "A", "TEST"]), upcase_lines
end
assert_equal __(["THIS", "IS", "A", "TEST"]), upcase_lines

# NOTE: You can create your own collections that work with each,
# map, select, etc.
Expand Down

0 comments on commit 0c18e97

Please sign in to comment.