File: io.rb

package info (click to toggle)
ruby-fakefs 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 544 kB
  • sloc: ruby: 7,622; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module FakeFS
  # FakeFS IO class inherit root IO
  # Only minimal mocks are provided as IO may be used by ruby's internals
  class IO < ::IO
    # Redirects ::IO.binread to ::FakeFS::File.binread
    def self.binread(*args)
      ::FakeFS::File.binread(*args)
    end

    # Redirects ::IO.read to ::FakeFS::File.read
    def self.read(*args)
      ::FakeFS::File.read(*args)
    end

    # Redirects ::IO.write to ::FakeFS::File.write
    def self.write(*args)
      ::FakeFS::File.write(*args)
    end
  end
end