Skip to content

Commit

Permalink
Fix 1.9 incompatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
agrimm committed Oct 27, 2009
1 parent 83ac34b commit 3143cf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/exemplor.rb
Expand Up @@ -70,7 +70,7 @@ def initialize
# Check foo
def Check(value)
file, line_number = caller.first.match(/^(.+):(\d+)/).captures
line = File.read(file).map[line_number.to_i - 1]
line = File.read(file).split("\n", -1)[line_number.to_i - 1]
name = line[/Check\((.+?)\)($|\.is.+|\[[^\]]+\])/,1]
check = Check.new(name, value)
_checks << check
Expand Down Expand Up @@ -211,7 +211,7 @@ def eg(name = nil, &example)
return Exemplor::Example if name.nil? && example.nil?
if name.nil?
file, line_number = caller.first.match(/^(.+):(\d+)/).captures
line = File.read(file).map[line_number.to_i - 1]
line = File.read(file).split("\n", -1)[line_number.to_i - 1]
name = line[/^\s*eg\s*\{\s*(.+?)\s*\}\s*$/,1] if name.nil?
raise Exemplor::ExampleDefinitionError, "example at #{caller.first} has no name so must be on one line" if name.nil?
end
Expand Down

0 comments on commit 3143cf1

Please sign in to comment.