lib/rgot/common.rb in rgot-1.2.0 vs lib/rgot/common.rb in rgot-1.3.0
- old
+ new
@@ -3,19 +3,20 @@
require 'thread'
require 'pathname'
module Rgot
class Common
+ # @dynamic output, output=
attr_accessor :output
def initialize
@output = "".dup
@failed = false
@skipped = false
@finished = false
@start = Rgot.now
- @mutex = Mutex.new
+ @mutex = Thread::Mutex.new
end
def failed?
@mutex.synchronize { @failed }
end
@@ -98,10 +99,10 @@
def decorate(str)
# internal_log -> synchronize -> internal_log -> other log -> running method
c = caller[4]
path = c.sub(/:.*/, '')
- line = c.match(/:(\d+?):/)[1]
+ line = c.match(/:(\d+?):/)&.[](1)
relative_path = Pathname.new(path).relative_path_from(Pathname.new(Dir.pwd)).to_s
# Every line is indented at least 4 spaces.
" #{relative_path}:#{line}: #{str}\n"
end