Class: Zold::Head
- Inherits:
-
Object
- Object
- Zold::Head
- Defined in:
- lib/zold/head.rb
Overview
Head of the wallet.
Defined Under Namespace
Classes: Cached
Instance Method Summary collapse
- #fetch ⇒ Object
- #flush ⇒ Object
-
#initialize(file) ⇒ Head
constructor
A new instance of Head.
Constructor Details
#initialize(file) ⇒ Head
Returns a new instance of Head.
32 33 34 |
# File 'lib/zold/head.rb', line 32 def initialize(file) @file = file end |
Instance Method Details
#fetch ⇒ Object
40 41 42 43 44 45 |
# File 'lib/zold/head.rb', line 40 def fetch raise "Wallet file '#{@file}' is absent" unless File.exist?(@file) lines = IO.read(@file).split(/\n/) raise "Not enough lines in #{@file}, just #{lines.count}" if lines.count < 4 lines.take(4) end |
#flush ⇒ Object
36 37 38 |
# File 'lib/zold/head.rb', line 36 def flush # nothing end |