OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
ruby
/
vendor_ruby
/
test
/
unit
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
assertion-failed-error.rb
748 bytes
07/04/2017 08:50:15 PM
rw-r--r--
📄
assertions.rb
74 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
attribute-matcher.rb
431 bytes
07/04/2017 08:50:15 PM
rw-r--r--
📄
attribute.rb
6.85 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
auto-runner-loader.rb
379 bytes
07/04/2017 08:50:15 PM
rw-r--r--
📄
autorunner.rb
16.29 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
code-snippet-fetcher.rb
1.49 KB
07/04/2017 08:50:15 PM
rw-r--r--
📁
collector
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
collector.rb
1.81 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
color-scheme.rb
7.12 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
color.rb
2.95 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
data.rb
8.34 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
diff.rb
25.42 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
error.rb
3.61 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
exception-handler.rb
2.7 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
failure.rb
5.09 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
fault-location-detector.rb
2.72 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
fixture.rb
9.03 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
notification.rb
3.34 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
omission.rb
4.5 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
pending.rb
3.61 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
priority.rb
4.39 KB
07/04/2017 08:50:15 PM
rw-r--r--
📁
runner
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
test-suite-creator.rb
2.69 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
testcase.rb
23.96 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
testresult.rb
3.2 KB
07/04/2017 08:50:15 PM
rw-r--r--
📄
testsuite.rb
4.8 KB
07/04/2017 08:50:15 PM
rw-r--r--
📁
ui
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📁
util
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
version.rb
58 bytes
07/04/2017 08:50:15 PM
rw-r--r--
Editing: code-snippet-fetcher.rb
Close
module Test module Unit class CodeSnippetFetcher def initialize @sources = {} end def fetch(path, line, options={}) n_context_line = options[:n_context_line] || 3 lines = source(path) return [] if lines.nil? min_line = [line - n_context_line, 1].max max_line = [line + n_context_line, lines.length].min window = min_line..max_line window.collect do |n| attributes = {:target_line? => (n == line)} [n, lines[n - 1].chomp, attributes] end end def source(path) @sources[path] ||= read_source(path) end private def read_source(path) return nil unless File.exist?(path) lines = [] File.open(path) do |file| first_line = file.gets break if first_line.nil? encoding = detect_encoding(first_line) if encoding first_line.force_encoding(encoding) file.set_encoding(encoding, encoding) end lines << first_line lines.concat(file.readlines) end lines end def detect_encoding(first_line) return nil unless first_line.respond_to?(:ascii_only?) return nil unless first_line.ascii_only? if /\b(?:en)?coding[:=]\s*([a-z\d_-]+)/i =~ first_line begin Encoding.find($1) rescue ArgumentError nil end else nil end end end end end