spook_and_puff_money 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/spook_and_puff/money.rb +3 -4
  2. metadata +1 -1
@@ -14,17 +14,16 @@ module SpookAndPuff
14
14
 
15
15
  # Initializes the money class from a BigDecimal instance.
16
16
  #
17
- # @param [BigDecimal, String] value
17
+ # @param [BigDecimal, String, SpookAndPuff::Money] value
18
18
  #
19
19
  # @return self
20
20
  #
21
21
  # @raise TypeError
22
- #
23
- # @todo This potentially should only handle BigDecimal, Money and String
24
22
  def initialize(value)
25
23
  @raw = case value
24
+ when SpookAndPuff::Money then value.raw
26
25
  when BigDecimal then value.round(7)
27
- when String then BigDecimal.new(value).round(7)
26
+ when String then BigDecimal.new(value.gsub(/\$/, '')).round(7)
28
27
  else raise TypeError.new("Money can only be initalized with a BigDecimal or String not #{value.class}.")
29
28
  end
30
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spook_and_puff_money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: