Class: Pero::History::Attribute
- Inherits:
-
Object
- Object
- Pero::History::Attribute
- Defined in:
- lib/pero/history.rb
Instance Method Summary collapse
-
#initialize(specinfra, options) ⇒ Attribute
constructor
A new instance of Attribute.
- #save(dir = "nodes") ⇒ Object
Constructor Details
#initialize(specinfra, options) ⇒ Attribute
Returns a new instance of Attribute.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pero/history.rb', line 23 def initialize(specinfra, ) name = if ["node-name"].nil? || ["node-name"].empty? specinfra.run_command("hostname").stdout.chomp else ["node-name"] end .delete("noop") .delete("tags") .delete("user") @h = { name: name, last_options: } end |
Instance Method Details
#save(dir = "nodes") ⇒ Object
38 39 40 41 |
# File 'lib/pero/history.rb', line 38 def save(dir="nodes") FileUtils.mkdir_p(dir) File.write("#{File.join(dir, @h[:name])}.json", @h.to_json) end |