Class: LiabilityProof::Generator
- Inherits:
-
Object
- Object
- LiabilityProof::Generator
- Defined in:
- lib/liability-proof/generator.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Generator
constructor
A new instance of Generator.
- #write! ⇒ Object
Constructor Details
#initialize(options) ⇒ Generator
Returns a new instance of Generator.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/liability-proof/generator.rb', line 6 def initialize() @accounts_path = .delete(:file) || 'accounts.json' @root_path = .delete(:root) || 'root.json' @partial_trees_dir = .delete(:partial_trees_dir) || 'partial_trees' FileUtils.mkdir @partial_trees_dir unless File.exists?(@partial_trees_dir) accounts = JSON.parse File.read(@accounts_path) @tree = LiabilityProof::Tree.new accounts, end |
Instance Method Details
#write! ⇒ Object
17 18 19 20 |
# File 'lib/liability-proof/generator.rb', line 17 def write! write_root_json @tree.indices.keys.each {|user| write_partial_tree(user) } end |