Class: Yast::BootloaderRoutinesLibIfaceInclude::TmpYAMLFile

Inherits:
Object
  • Object
show all
Defined in:
src/include/bootloader/routines/lib_iface.rb

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (TmpYAMLFile) initialize(data = nil)

Returns a new instance of TmpYAMLFile



50
51
52
53
# File 'src/include/bootloader/routines/lib_iface.rb', line 50

def initialize(data = nil)
  @path = mktemp
  write_data(data) unless data.nil?
end

Instance Attribute Details

- (Object) path (readonly)

Returns the value of attribute path



41
42
43
# File 'src/include/bootloader/routines/lib_iface.rb', line 41

def path
  @path
end

Class Method Details

+ (Object) open(data = nil, &block)



43
44
45
46
47
48
# File 'src/include/bootloader/routines/lib_iface.rb', line 43

def self.open(data = nil, &block)
  file = new(data)
  block.call(file)
ensure
  file.unlink if file
end

Instance Method Details

- (Object) data



59
60
61
# File 'src/include/bootloader/routines/lib_iface.rb', line 59

def data
  YAML.load(SCR.Read(Path.new(".target.string"), path))
end


55
56
57
# File 'src/include/bootloader/routines/lib_iface.rb', line 55

def unlink
  SCR.Execute(Path.new(".target.remove"), path)
end