Class: AssOle::Snippets::Shared::BinaryData::TempFile Private
- Inherits:
-
Object
- Object
- AssOle::Snippets::Shared::BinaryData::TempFile
- Includes:
- IsSnippet::WinPath
- Defined in:
- lib/ass_ole/snippets/shared/binary_data.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #data ⇒ Object readonly private
Instance Method Summary collapse
- #exist? ⇒ Boolean private
-
#initialize(data) ⇒ TempFile
constructor
private
A new instance of TempFile.
- #path ⇒ Object private
- #read ⇒ Object private
- #rm! ⇒ Object private
- #temp_file ⇒ Object private
- #win_path ⇒ Object private
- #write ⇒ Object private
Constructor Details
#initialize(data) ⇒ TempFile
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TempFile.
15 16 17 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 15 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 14 def data @data end |
Instance Method Details
#exist? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 37 def exist? return false unless path File.exist? path end |
#path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 46 def path temp_file.path end |
#read ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 28 def read temp_file.open temp_file.read end |
#rm! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 42 def rm! temp_file.unlink if exist? end |
#temp_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 33 def temp_file @temp_file ||= Tempfile.new('ass_ole_bin_data') end |
#win_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 19 def win_path real_win_path path end |
#write ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 |
# File 'lib/ass_ole/snippets/shared/binary_data.rb', line 23 def write temp_file.write(data) temp_file.close end |