Method: Cnvrg::Dataset#write_idx
- Defined in:
- lib/cnvrg/dataset.rb
#write_idx(tree = nil, commit = nil) ⇒ Object
378 379 380 381 382 383 384 385 |
# File 'lib/cnvrg/dataset.rb', line 378 def write_idx(tree=nil, commit=nil) if tree.blank? tree = self.generate_idx[:tree] tree = tree.map{|k,v| (v.present?)? [k, {sha1: v[:sha1], commit_time: Time.now}] : [k,v]}.to_h end idx = {tree: tree, commit: commit} File.open("#{self.local_path}/.cnvrg/idx.yml", 'w') { |f| f.write idx.to_yaml } end |