Class: Stackup::RakeTasks::DataOptionHash

Inherits:
DataOption
  • Object
show all
Defined in:
lib/stackup/rake_tasks.rb

Overview

An option with a Hash argument Hash content is stored in a temporary file upon conversion

Instance Attribute Summary

Attributes inherited from DataOption

#argument, #flag

Instance Method Summary collapse

Methods inherited from DataOption

for, #initialize

Constructor Details

This class inherits a constructor from Stackup::RakeTasks::DataOption

Instance Method Details

#as_tempfile(filename, data) ⇒ Object



115
116
117
118
119
120
# File 'lib/stackup/rake_tasks.rb', line 115

def as_tempfile(filename, data)
  tempfile = Tempfile.new([filename, ".yml"])
  tempfile.write(YAML.dump(data))
  tempfile.close
  tempfile.path.to_s
end

#to_aObject



122
123
124
# File 'lib/stackup/rake_tasks.rb', line 122

def to_a
  [@flag, as_tempfile(@flag[2..-1], @argument)]
end