Method: Zold::Txns#fetch
- Defined in:
- lib/zold/txns.rb
#fetch ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/zold/txns.rb', line 43 def fetch raise "Wallet file '#{@file}' is absent" unless File.exist?(@file) txns = [] i = 0 File.open(@file) do |f| until f.eof? line = f.readline i += 1 next if i < 5 next if line.strip.empty? txns << Txn.parse(line, i) end end raise CantParse, "Not enough lines in #{@file}, just #{i}" if i < 4 txns.sort end |