Class: Solis::OverlayFS::OverlayIO
- Inherits:
-
Object
- Object
- Solis::OverlayFS::OverlayIO
- Extended by:
- Forwardable
- Defined in:
- lib/solis/overlay_fs.rb
Overview
IO wrapper that handles copy-up on write
Instance Method Summary collapse
- #<<(data) ⇒ Object
- #close ⇒ Object
- #close_write ⇒ Object
- #closed? ⇒ Boolean
- #flush ⇒ Object
-
#initialize(io, overlay_fs: nil, relative_path: nil, mode: 'r') ⇒ OverlayIO
constructor
A new instance of OverlayIO.
- #path ⇒ Object
- #print(*args) ⇒ Object
- #printf(*args) ⇒ Object
- #puts(*args) ⇒ Object
- #to_io ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(io, overlay_fs: nil, relative_path: nil, mode: 'r') ⇒ OverlayIO
Returns a new instance of OverlayIO.
28 29 30 31 32 33 34 |
# File 'lib/solis/overlay_fs.rb', line 28 def initialize(io, overlay_fs: nil, relative_path: nil, mode: 'r') @io = io = @relative_path = relative_path @mode = mode @copied_up = false end |
Instance Method Details
#<<(data) ⇒ Object
56 57 58 59 60 |
# File 'lib/solis/overlay_fs.rb', line 56 def <<(data) ensure_copy_up if && !@copied_up @io << data self end |
#close ⇒ Object
66 67 68 |
# File 'lib/solis/overlay_fs.rb', line 66 def close @io.close end |
#close_write ⇒ Object
74 75 76 |
# File 'lib/solis/overlay_fs.rb', line 74 def close_write @io.close_write end |
#closed? ⇒ Boolean
70 71 72 |
# File 'lib/solis/overlay_fs.rb', line 70 def closed? @io.closed? end |
#flush ⇒ Object
62 63 64 |
# File 'lib/solis/overlay_fs.rb', line 62 def flush @io.flush end |
#path ⇒ Object
78 79 80 |
# File 'lib/solis/overlay_fs.rb', line 78 def path @io.respond_to?(:path) ? @io.path : nil end |
#print(*args) ⇒ Object
46 47 48 49 |
# File 'lib/solis/overlay_fs.rb', line 46 def print(*args) ensure_copy_up if && !@copied_up @io.print(*args) end |
#printf(*args) ⇒ Object
51 52 53 54 |
# File 'lib/solis/overlay_fs.rb', line 51 def printf(*args) ensure_copy_up if && !@copied_up @io.printf(*args) end |
#puts(*args) ⇒ Object
41 42 43 44 |
# File 'lib/solis/overlay_fs.rb', line 41 def puts(*args) ensure_copy_up if && !@copied_up @io.puts(*args) end |
#to_io ⇒ Object
82 83 84 |
# File 'lib/solis/overlay_fs.rb', line 82 def to_io @io end |
#write(data) ⇒ Object
36 37 38 39 |
# File 'lib/solis/overlay_fs.rb', line 36 def write(data) ensure_copy_up if && !@copied_up @io.write(data) end |