Class: Bio::Ngs::Record
- Inherits:
-
Object
- Object
- Bio::Ngs::Record
- Defined in:
- lib/bio/ngs/record.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(file) ⇒ Record
constructor
A new instance of Record.
- #load ⇒ Object
- #save(name, *args) ⇒ Object
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
#clear ⇒ Object
36 37 38 |
# File 'lib/bio/ngs/record.rb', line 36 def clear history = File.delete(@filename) end |
#load ⇒ Object
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 |