Module: CorrectHorseBatteryStaple::Util

Defined in:
lib/correct_horse_battery_staple.rb

Class Method Summary collapse

Class Method Details

.open_binary(filename, mode = "r", *rest) ⇒ Object



95
96
97
# File 'lib/correct_horse_battery_staple.rb', line 95

def self.open_binary(filename, mode = "r", *rest)
  open(filename, openmode(mode), *rest)
end

.openmode(mode) ⇒ Object



99
100
101
# File 'lib/correct_horse_battery_staple.rb', line 99

def self.openmode(mode)
  IO.respond_to?(:binwrite) ? "#{mode}b:ASCII-8BIT" : mode
end