Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/railsbench/perf_utils.rb
Class Method Summary collapse
Class Method Details
.open_or_die(filename, &block) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/railsbench/perf_utils.rb', line 51 def self.open_or_die(filename, &block) filename = filename.sub(/^\/([cdefgh])(\/)/, '\1:\2') if RUBY_PLATFORM =~ /win32/ begin if stat(filename).readable? open(filename, &block) else die "file #{filename} is unreadable" end rescue die "file #{filename} does not exist" end end |