Class: Bin2Hex::BinaryToHexFileConverter
- Inherits:
-
Object
- Object
- Bin2Hex::BinaryToHexFileConverter
- Defined in:
- lib/bin2hex.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ BinaryToHexFileConverter
constructor
A new instance of BinaryToHexFileConverter.
- #process_file(input, output) ⇒ Object
Constructor Details
#initialize(options) ⇒ BinaryToHexFileConverter
Returns a new instance of BinaryToHexFileConverter.
4 5 6 |
# File 'lib/bin2hex.rb', line 4 def initialize() @options = end |
Instance Method Details
#process_file(input, output) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bin2hex.rb', line 8 def process_file(input, output) begin File.open(sprintf(output, input), "w") do |out_file| File.open(input, "rb").each_byte do |b| out_file.write(sprintf(@options[:format], b)) end end rescue Errno::ENOENT => e puts "Error: #{e.}" end end |