Class: Bio::Ngs::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/ngs/record.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Record

Returns a new instance of Record.



14
15
16
17
# File 'lib/bio/ngs/record.rb', line 14

def initialize(file)
  @filename = file
  @file = File.new(file,"a+")
end

Instance Method Details

#clearObject



36
37
38
# File 'lib/bio/ngs/record.rb', line 36

def clear
  history = File.delete(@filename)
end

#loadObject



27
28
29
30
31
32
33
34
# File 'lib/bio/ngs/record.rb', line 27

def load   
    tasks = []
    YAML.load_stream(@file) do |ydoc| 
      ydoc[:args].flatten!
      tasks << ydoc
    end
    return tasks
end

#save(name, *args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/bio/ngs/record.rb', line 19

def save(name,*args)
  params = {:name => name, :args => args }
  unless is_saved?(params) || params[:name] =~/history/
    @file.write(params.to_yaml)
    @file.close
  end
end