lib/murky/dict.rb in murky_waters-0.1.2 vs lib/murky/dict.rb in murky_waters-0.1.3

- old
+ new

@@ -1,7 +1,8 @@ module Murky class Dict + include Enumerable attr_reader :root def initialize(data: {}, digest: Digest::SHA256.new) @root = nil @digest = digest @@ -53,10 +54,14 @@ def root @root = @changed ? compute_root : @root end + def each(&block) + data.each(&block) + end + def proof(key) Proof.new({ root: root, siblings: siblings(key), signature: sign(data[key]), @@ -78,14 +83,14 @@ end return siblings end def to_s - "Murky::Dict(#{data.to_s})" + "Murky::Dict(data: #{data.to_s})" end def inspect - "Murky::Dict(#{data.inspect})" + "Murky::Dict(data: #{data.inspect})" end private def compute_root(values=self.values, from_bottom=0, &block) if values.length == 1 \ No newline at end of file