cashrb 1.0.1 → 1.0.2
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.
- data/CHANGELOG.md +5 -0
- data/cashrb.gemspec +1 -1
- data/lib/cash/cash.rb +11 -11
- data/lib/cash/cash.rbc +3610 -0
- data/lib/cash.rbc +53 -0
- data/test/test_cash.rb +1 -0
- data/test/test_cash.rbc +10654 -0
- metadata +39 -21
data/CHANGELOG.md
CHANGED
data/cashrb.gemspec
CHANGED
data/lib/cash/cash.rb
CHANGED
@@ -105,6 +105,17 @@ class Cash
|
|
105
105
|
self.to_s.to_f
|
106
106
|
end
|
107
107
|
|
108
|
+
CURRENCY_AWARE_METHODS.each do |mth|
|
109
|
+
old_mth = :"old_#{mth}"
|
110
|
+
alias_method old_mth, mth
|
111
|
+
private(old_mth)
|
112
|
+
|
113
|
+
define_method(mth) do |value|
|
114
|
+
reject_incompatible_currency(value)
|
115
|
+
send(old_mth, value)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
108
119
|
private
|
109
120
|
|
110
121
|
def bd(val)
|
@@ -145,15 +156,4 @@ class Cash
|
|
145
156
|
rescue NoMethodError
|
146
157
|
end
|
147
158
|
|
148
|
-
CURRENCY_AWARE_METHODS.each do |mth|
|
149
|
-
old_mth = :"old_#{mth}"
|
150
|
-
alias_method old_mth, mth
|
151
|
-
private(old_mth)
|
152
|
-
|
153
|
-
define_method(mth) do |value|
|
154
|
-
reject_incompatible_currency(value)
|
155
|
-
send(old_mth, value)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
159
|
end
|