Class: A4Tools::FileOverwriteOutput
- Inherits:
-
StandardOutput
- Object
- StandardOutput
- A4Tools::FileOverwriteOutput
- Defined in:
- lib/net_shell/io.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from StandardOutput
Instance Method Summary collapse
- #access_type ⇒ Object
- #close ⇒ Object
-
#initialize(filename) ⇒ FileOverwriteOutput
constructor
A new instance of FileOverwriteOutput.
- #write(s) ⇒ Object
Methods inherited from StandardOutput
Constructor Details
#initialize(filename) ⇒ FileOverwriteOutput
Returns a new instance of FileOverwriteOutput.
73 74 75 |
# File 'lib/net_shell/io.rb', line 73 def initialize(filename) @filename = filename end |
Instance Method Details
#access_type ⇒ Object
77 78 79 |
# File 'lib/net_shell/io.rb', line 77 def access_type "w" end |
#close ⇒ Object
88 89 90 |
# File 'lib/net_shell/io.rb', line 88 def close @fd.close end |
#write(s) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/net_shell/io.rb', line 81 def write(s) s = s.unstyle unless @color @fd ||= File.open(@filename, access_type) @fd.write(s) @fd.flush end |