T
Todd A. Jacobs
I'm running into a problem doing a conditional range in ruby. The sample
code is:
#!/usr/bin/ruby
## one
## two
## three
## four
## five
File.open($0, 'r') { |f|
while f.gets
print $_.sub(/^##/, '') if /^## two/ .. /^## four/
end
}
I'm expecting:
two
three
four
but I get the whole file with the leading pound signs stripped off.
What's wrong here?
code is:
#!/usr/bin/ruby
## one
## two
## three
## four
## five
File.open($0, 'r') { |f|
while f.gets
print $_.sub(/^##/, '') if /^## two/ .. /^## four/
end
}
I'm expecting:
two
three
four
but I get the whole file with the leading pound signs stripped off.
What's wrong here?