sibit 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sibit/version.rb +1 -1
  3. data/lib/sibit.rb +5 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3a43b936233c3696c6ef43eda40f6cfd6b42a448b2cd2c2fa57dc2eec0533d7
4
- data.tar.gz: 6f0bd0f222a56f9ff38bc137d3c74b5f7e05a9c1b9f9517c628f5ef17127cf68
3
+ metadata.gz: 8b9718bc8fe630a39247c01b3c9d4a5e631709c48f06fccc9b63c7fa10e67f2d
4
+ data.tar.gz: b960f89f169ccb01d87017f546bd818bd559e8d28924d9eb044ba7afb14e443f
5
5
  SHA512:
6
- metadata.gz: 26b5edf51dee90e3e689a9a66048cbb5283f41fcbaf609e26e26255edf026ad122038b0e832c70ab72189fff508aa457b270a09dd40fdadbce90d070c31d5e17
7
- data.tar.gz: c46200102cffd179d157ebd55b5bf3891bea99ee346658b6f4c4db2ac69ce26d21f2de1e4585c75d45cfa50c876e914cd83ac545ca85cbae5c448f370f70feba
6
+ metadata.gz: 9bcdc3c1e028aecc3ddfceeb2cce3fab667f75bff6dfd65a6fae0aa15a6dc97024b3018a5eb76ad8da7e19942c10910c38339ea49752c6c85d851475c7d82343
7
+ data.tar.gz: 32da3065c371cfda7bcf6374dd0592f74d602fe434d50f2107ac5fd6a0bc41bd2cbe618c870466d3dca5a288b7a73d3f8acef94df934d579559683aa3aa87878
data/lib/sibit/version.rb CHANGED
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.7.1'
29
+ VERSION = '0.7.2'
30
30
  end
data/lib/sibit.rb CHANGED
@@ -173,12 +173,15 @@ class Sibit
173
173
 
174
174
  # Convert text to amount.
175
175
  def satoshi(amount)
176
+ return amount if amount.is_a?(Integer)
177
+ raise Error, 'Amount should either be a String or Integer' unless amount.is_a?(String)
176
178
  return (amount.gsub(/BTC$/, '').to_f * 100_000_000).to_i if amount.end_with?('BTC')
177
- amount.to_i
179
+ raise Error, "Can't understand the amount #{amount.inspect}"
178
180
  end
179
181
 
180
182
  def mfee(fee, size)
181
- return fee.to_i if fee.is_a?(Integer) || /^[0-9]+$/.match?(fee)
183
+ return fee.to_i if fee.is_a?(Integer)
184
+ raise Error, 'Fee should either be a String or Integer' unless fee.is_a?(String)
182
185
  case fee
183
186
  when 'S'
184
187
  return 10 * size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko