lib/rspec/apib/recorder.rb in rspec-apib-0.3.2 vs lib/rspec/apib/recorder.rb in rspec-apib-0.3.3
- old
+ new
@@ -152,23 +152,23 @@
return unless File.exists?(file)
lines = IO.readlines(file)
return if lines.count < line
i = line -2
m = false
- while (i >= 0 && lines[i].match(/\A\W*#/)) do
- if lines[i - 1].match(/\A\W*# --- apib/)
+ while (i >= 0 && lines[i].match(/\A\s*#/)) do
+ if lines[i - 1].match(/\A\s*# --- apib/)
m = true
break
end
i -= 1
end
return unless m
result = []
- while (i < line && lines[i].match(/\A\W*#/)) do
- if lines[i].match(/\A\W*# ---/)
+ while (i < line && lines[i].match(/\A\s*#/)) do
+ if lines[i].match(/\A\s*# ---\s*\z/)
break
end
- result << lines[i].sub(/^\W*#\W*/, '').strip
+ result << lines[i].sub(/^\s*#\s*/, '').strip
i += 1
end
return result.join("\n")
end