money-tree 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c23b677db0ad358bcfd0244824fc85deba21b862
4
- data.tar.gz: 20a72958960ef90d0a68d9baa0b22976bf47664a
3
+ metadata.gz: e6a3ecbdcd5b3a5f520f5d34eedb0158ad7ad716
4
+ data.tar.gz: 999bc086f43b012af5b2de444c43bac102e2cbe1
5
5
  SHA512:
6
- metadata.gz: 372fd601d8cdcb2b0bde5fbb2d8f66c420ef824bda827b4dd7fd0501643197f75b6329ed9e03198cb60d543e305f879c9ef8e85b6cdfb9efad807b6b807092fe
7
- data.tar.gz: b3f4c904255fa588e9ee442722ca0a539e86fd56cecdd80f7c09885466ed5b8062b5d680e92d7657102a897f2bdf0f669b4d6537ffda9be7d55acc79d739798e
6
+ metadata.gz: 10019f4bf74c84af796336033c0f67ae2fac8df851c028e95942a1c717a9afe78be6ae190c9d8de932a16e461e950645c9d0023e9a2e084a8e54a09fd1df6e3d
7
+ data.tar.gz: 70d2850af773d64babf1ce5711e055f79bdfa281fc1b92d7a07bdecad4bed3022977e06d079eed64573e2ecc1e633b429af7b7063cc1c552ea9711459af61f0b
@@ -180,13 +180,13 @@ module MoneyTree
180
180
  end
181
181
 
182
182
  def compressed
183
- compressed_key = self.dup
183
+ compressed_key = self.class.new raw_key # deep clone
184
184
  compressed_key.set_point to_i, compressed: true
185
185
  compressed_key
186
186
  end
187
187
 
188
188
  def uncompressed
189
- uncompressed_key = self.dup
189
+ uncompressed_key = self.class.new raw_key # deep clone
190
190
  uncompressed_key.set_point to_i, compressed: false
191
191
  uncompressed_key
192
192
  end
@@ -179,7 +179,8 @@ module MoneyTree
179
179
  nodes << self
180
180
  else
181
181
  i = parse_index(part)
182
- nodes << nodes.last.subnode(i)
182
+ node = nodes.last || self
183
+ nodes << node.subnode(i)
183
184
  end
184
185
  end
185
186
  if force_public or parts.first == 'M'
@@ -1,3 +1,3 @@
1
1
  module MoneyTree
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
@@ -121,4 +121,40 @@ describe MoneyTree::PublicKey do
121
121
  lambda { @key = MoneyTree::PublicKey.new 'THISISNOTAVALIDKEY' }.should raise_error(MoneyTree::Key::KeyFormatNotFound)
122
122
  end
123
123
  end
124
+
125
+ describe "recalcuating public key" do
126
+ it "produces same results" do
127
+ results = []
128
+ 100.times do
129
+ results << MoneyTree::PublicKey.new('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4').to_s
130
+ end
131
+ results.uniq.length.should == 1
132
+ end
133
+ end
134
+
135
+ describe "#uncompressed" do
136
+ before do
137
+ @key = MoneyTree::PublicKey.new('022dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b')
138
+ end
139
+
140
+ it "does not mutate key" do
141
+ before_str = @key.to_s
142
+ @key.uncompressed
143
+ after_str = @key.to_s
144
+ before_str.should == after_str
145
+ end
146
+ end
147
+
148
+ describe "#compressed" do
149
+ before do
150
+ @key = MoneyTree::PublicKey.new('042dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b11203096f1a1c5276a73f91b9465357004c2103cc42c63d6d330df589080d2e4')
151
+ end
152
+
153
+ it "does not mutate key" do
154
+ before_str = @key.to_s
155
+ @key.compressed
156
+ after_str = @key.to_s
157
+ before_str.should == after_str
158
+ end
159
+ end
124
160
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Winkelspecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi