Class: AssOle::Snippets::Shared::BinaryData::TempFile Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#dataObject (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.

Returns:

  • (Boolean)


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

#pathObject

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

#readObject

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_fileObject

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_pathObject

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

#writeObject

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