bc 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data.tar.gz.sig +0 -0
  2. data/lib/bc.rb +11 -4
  3. metadata +3 -3
  4. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/lib/bc.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require 'bigdecimal'
2
3
  require 'json/pure'
3
4
  require 'net/http'
4
5
  require 'jr'
@@ -6,7 +7,7 @@ require 'jr'
6
7
  # This redefines Float() so that JSON floats will be returned as BigDecimals.
7
8
  # This is neccessary because bitcoind returns Floats that are actually decimals
8
9
  # with a precision of 8. FUCK YOU, bitcoind.
9
- class JSON::Pure::Parser
10
+ class JSON::BigDecimalParser < JSON::Pure::Parser
10
11
  private
11
12
 
12
13
  def Float(num)
@@ -14,8 +15,14 @@ class JSON::Pure::Parser
14
15
  end
15
16
  end
16
17
 
17
- JSON.send(:remove_const, :Parser)
18
- JSON::Parser = JSON::Pure::Parser
18
+ # This is like Jr::Jr, but instead of Floats, we use BigDecimals.
19
+ class Jr::BigDecimalJr < Jr::Jr
20
+ private
21
+
22
+ def parse_json_data(data)
23
+ JSON::BigDecimalParser.new(data).parse()
24
+ end
25
+ end
19
26
 
20
27
  module Bitcoin
21
28
  # Errors that the bitcoind is expected to raise should derive from this class.
@@ -559,7 +566,7 @@ module Bitcoin
559
566
  instance_variable_set("@#{var}", eval(var))
560
567
  end
561
568
 
562
- @jr = Jr::Jr.new(@host, @port, @user, @password, ssl)
569
+ @jr = Jr::BigDecimalJr.new(@host, @port, @user, @password, ssl)
563
570
 
564
571
  @accounts = Hash.new
565
572
  @addresses = Hash.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -54,7 +54,7 @@ date: 2012-04-27 00:00:00.000000000 Z
54
54
  dependencies:
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jr
57
- requirement: &82577590 !ruby/object:Gem::Requirement
57
+ requirement: &85476470 !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
60
  - - ! '>='
@@ -62,7 +62,7 @@ dependencies:
62
62
  version: '0'
63
63
  type: :runtime
64
64
  prerelease: false
65
- version_requirements: *82577590
65
+ version_requirements: *85476470
66
66
  description: bc is a Ruby interface to bitcoind.
67
67
  email: the.magical.kat@gmail.com
68
68
  executables: []
metadata.gz.sig CHANGED
Binary file