privat_bank_business_api 0.2.1
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 +7 -0
- data/.devcontainer/Dockerfile +17 -0
- data/.devcontainer/devcontainer.json +33 -0
- data/.devcontainer/post-create.sh +8 -0
- data/.rspec +3 -0
- data/.rubocop.yml +9 -0
- data/.vscode/settings.json +6 -0
- data/CHANGELOG.md +12 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +123 -0
- data/Rakefile +12 -0
- data/lib/pb_api/base_transformer.rb +19 -0
- data/lib/pb_api/client.rb +41 -0
- data/lib/pb_api/models/balance.rb +79 -0
- data/lib/pb_api/models/base_struct.rb +30 -0
- data/lib/pb_api/models/transaction.rb +114 -0
- data/lib/pb_api/pagination_helper.rb +73 -0
- data/lib/pb_api/resource.rb +97 -0
- data/lib/pb_api/resources/balance_resource.rb +40 -0
- data/lib/pb_api/resources/transaction_resource.rb +105 -0
- data/lib/pb_api/transformers/balance_transformer.rb +35 -0
- data/lib/pb_api/transformers/transaction_transformer.rb +46 -0
- data/lib/pb_api/types.rb +8 -0
- data/lib/pb_api/version.rb +5 -0
- data/lib/pb_api.rb +34 -0
- data/sig/privat_bank_buisness_api.rbs +4 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/faraday.rbi +17 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +9 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +9 -0
- data/sorbet/rbi/gems/date@3.4.1.rbi +75 -0
- data/sorbet/rbi/gems/diff-lcs@1.6.0.rbi +1134 -0
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +9 -0
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +9 -0
- data/sorbet/rbi/gems/dry-struct@1.7.1.rbi +925 -0
- data/sorbet/rbi/gems/dry-transformer@1.0.1.rbi +1512 -0
- data/sorbet/rbi/gems/dry-types@1.8.2.rbi +9 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +9 -0
- data/sorbet/rbi/gems/faraday-multipart@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.2.rbi +9 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +9 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +9 -0
- data/sorbet/rbi/gems/faraday@1.10.4.rbi +9 -0
- data/sorbet/rbi/gems/faraday_middleware@1.2.1.rbi +9 -0
- data/sorbet/rbi/gems/i18n@1.14.7.rbi +2208 -0
- data/sorbet/rbi/gems/ice_nine@0.11.2.rbi +9 -0
- data/sorbet/rbi/gems/io-console@0.8.0.rbi +9 -0
- data/sorbet/rbi/gems/json@2.10.1.rbi +2120 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
- data/sorbet/rbi/gems/logger@1.6.6.rbi +940 -0
- data/sorbet/rbi/gems/money@6.19.0.rbi +2260 -0
- data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +9 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.7.1.rbi +5525 -0
- data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
- data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
- data/sorbet/rbi/gems/prism@1.3.0.rbi +41403 -0
- data/sorbet/rbi/gems/psych@5.2.3.rbi +2435 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +164 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
- data/sorbet/rbi/gems/rbi@0.2.4.rbi +4542 -0
- data/sorbet/rbi/gems/rdoc@6.12.0.rbi +12758 -0
- data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3795 -0
- data/sorbet/rbi/gems/reline@0.6.0.rbi +2451 -0
- data/sorbet/rbi/gems/rspec-core@3.13.3.rbi +10986 -0
- data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +8183 -0
- data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +5341 -0
- data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +1630 -0
- data/sorbet/rbi/gems/rspec@3.13.0.rbi +83 -0
- data/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +7654 -0
- data/sorbet/rbi/gems/rubocop@1.72.2.rbi +61026 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/spoom@1.5.4.rbi +5026 -0
- data/sorbet/rbi/gems/stringio@3.1.5.rbi +9 -0
- data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3656 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
- data/sorbet/rbi/gems/zeitwerk@2.7.2.rbi +9 -0
- data/sorbet/rbi/todo.rbi +17 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +8 -0
- metadata +231 -0
@@ -0,0 +1,2260 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `money` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem money`.
|
6
|
+
|
7
|
+
|
8
|
+
# "Money is any object or record that is generally accepted as payment for
|
9
|
+
# goods and services and repayment of debts in a given socio-economic context
|
10
|
+
# or country." -Wikipedia
|
11
|
+
#
|
12
|
+
# An instance of Money represents an amount of a specific currency.
|
13
|
+
#
|
14
|
+
# Money is a value object and should be treated as immutable.
|
15
|
+
#
|
16
|
+
# @see http://en.wikipedia.org/wiki/Money
|
17
|
+
#
|
18
|
+
# source://money//lib/money/currency/loader.rb#1
|
19
|
+
class Money
|
20
|
+
include ::Comparable
|
21
|
+
include ::Money::Arithmetic
|
22
|
+
extend ::Money::Constructors
|
23
|
+
|
24
|
+
# Creates a new Money object of value given in the
|
25
|
+
# +fractional unit+ of the given +currency+.
|
26
|
+
#
|
27
|
+
# Alternatively you can use the convenience
|
28
|
+
# methods like {Money.ca_dollar} and {Money.us_dollar}.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Money.new(100) #=> #<Money @fractional=100 @currency="USD">
|
32
|
+
# Money.new(100, "USD") #=> #<Money @fractional=100 @currency="USD">
|
33
|
+
# Money.new(100, "EUR") #=> #<Money @fractional=100 @currency="EUR">
|
34
|
+
# @option [Money::Bank::*]
|
35
|
+
# @param obj [Object] Either the fractional value of the money,
|
36
|
+
# a Money object, or a currency. (If passed a currency as the first
|
37
|
+
# argument, a Money will be created in that currency with fractional value
|
38
|
+
# = 0.
|
39
|
+
# @param currency [Currency, String, Symbol] The currency format.
|
40
|
+
# @param options [Hash] Optional settings for the new Money instance
|
41
|
+
# @param [Money::Bank::*] [Hash] a customizable set of options
|
42
|
+
# @raise [ArgumentError]
|
43
|
+
# @return [Money]
|
44
|
+
#
|
45
|
+
# source://money//lib/money/money.rb#341
|
46
|
+
def initialize(obj, currency = T.unsafe(nil), options = T.unsafe(nil)); end
|
47
|
+
|
48
|
+
# Splits a given amount in parts without losing pennies. The left-over pennies will be
|
49
|
+
# distributed round-robin amongst the parties. This means that parts listed first will likely
|
50
|
+
# receive more pennies than ones listed later.
|
51
|
+
#
|
52
|
+
# Pass [2, 1, 1] as input to give twice as much to part1 as part2 or
|
53
|
+
# part3 which results in 50% of the cash to party1, 25% to part2, and 25% to part3. Passing a
|
54
|
+
# number instead of an array will split the amount evenly (without losing pennies when rounding).
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Money.new(5, "USD").allocate([3, 7]) #=> [Money.new(2), Money.new(3)]
|
58
|
+
# Money.new(100, "USD").allocate([1, 1, 1]) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
59
|
+
# Money.new(100, "USD").allocate(2) #=> [Money.new(50), Money.new(50)]
|
60
|
+
# Money.new(100, "USD").allocate(3) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
61
|
+
# @param parts [Array<Numeric>, Numeric] how amount should be distributed to parts
|
62
|
+
# @return [Array<Money>]
|
63
|
+
#
|
64
|
+
# source://money//lib/money/money.rb#595
|
65
|
+
def allocate(parts); end
|
66
|
+
|
67
|
+
# Returns the numerical value of the money
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Money.new(1_00, "USD").amount # => BigDecimal("1.00")
|
71
|
+
# @return [BigDecimal]
|
72
|
+
# @see #to_d
|
73
|
+
# @see #fractional
|
74
|
+
#
|
75
|
+
# source://money//lib/money/money.rb#386
|
76
|
+
def amount; end
|
77
|
+
|
78
|
+
# Receive a money object with the same amount as the current Money object
|
79
|
+
# in Canadian dollar.
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# n = Money.new(100, "USD").as_ca_dollar
|
83
|
+
# n.currency #=> #<Money::Currency id: cad>
|
84
|
+
# @return [Money]
|
85
|
+
#
|
86
|
+
# source://money//lib/money/money.rb#561
|
87
|
+
def as_ca_dollar; end
|
88
|
+
|
89
|
+
# Receive a money object with the same amount as the current Money object
|
90
|
+
# in euro.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# n = Money.new(100, "USD").as_euro
|
94
|
+
# n.currency #=> #<Money::Currency id: eur>
|
95
|
+
# @return [Money]
|
96
|
+
#
|
97
|
+
# source://money//lib/money/money.rb#573
|
98
|
+
def as_euro; end
|
99
|
+
|
100
|
+
# Receive a money object with the same amount as the current Money object
|
101
|
+
# in United States dollar.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# n = Money.new(100, "CAD").as_us_dollar
|
105
|
+
# n.currency #=> #<Money::Currency id: usd>
|
106
|
+
# @return [Money]
|
107
|
+
#
|
108
|
+
# source://money//lib/money/money.rb#549
|
109
|
+
def as_us_dollar; end
|
110
|
+
|
111
|
+
# Returns the value of attribute bank.
|
112
|
+
#
|
113
|
+
# source://money//lib/money/money.rb#88
|
114
|
+
def bank; end
|
115
|
+
|
116
|
+
# Convenience method for fractional part of the amount. Synonym of #fractional
|
117
|
+
#
|
118
|
+
# @return [Integer] when infinite_precision is false
|
119
|
+
# @return [BigDecimal] when infinite_precision is true
|
120
|
+
# @see infinite_precision
|
121
|
+
#
|
122
|
+
# source://money//lib/money/money.rb#33
|
123
|
+
def cents; end
|
124
|
+
|
125
|
+
# @return [Currency] The money's currency.
|
126
|
+
#
|
127
|
+
# source://money//lib/money/money.rb#88
|
128
|
+
def currency; end
|
129
|
+
|
130
|
+
# Return string representation of currency object
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# Money.new(100, :USD).currency_as_string #=> "USD"
|
134
|
+
# @return [String]
|
135
|
+
#
|
136
|
+
# source://money//lib/money/money.rb#396
|
137
|
+
def currency_as_string; end
|
138
|
+
|
139
|
+
# Set currency object using a string
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# Money.new(100).currency_as_string("CAD") #=> #<Money::Currency id: cad>
|
143
|
+
# @param val [String] The currency string.
|
144
|
+
# @return [Money::Currency]
|
145
|
+
#
|
146
|
+
# source://money//lib/money/money.rb#409
|
147
|
+
def currency_as_string=(val); end
|
148
|
+
|
149
|
+
# Returns a decimal mark according to the locale
|
150
|
+
#
|
151
|
+
# @return [String]
|
152
|
+
#
|
153
|
+
# source://money//lib/money/money.rb#644
|
154
|
+
def decimal_mark; end
|
155
|
+
|
156
|
+
# Assuming using a currency using dollars:
|
157
|
+
# Returns the value of the money in dollars,
|
158
|
+
# instead of in the fractional unit cents.
|
159
|
+
#
|
160
|
+
# Synonym of #amount
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# Money.new(1_00, "USD").dollars # => BigDecimal("1.00")
|
164
|
+
# @return [BigDecimal]
|
165
|
+
# @see #amount
|
166
|
+
# @see #to_d
|
167
|
+
# @see #cents
|
168
|
+
#
|
169
|
+
# source://money//lib/money/money.rb#372
|
170
|
+
def dollars; end
|
171
|
+
|
172
|
+
# source://money//lib/money/money.rb#649
|
173
|
+
def dup_with(options = T.unsafe(nil)); end
|
174
|
+
|
175
|
+
# Receive the amount of this money object in another Currency.
|
176
|
+
#
|
177
|
+
# @example
|
178
|
+
# Money.new(2000, "USD").exchange_to("EUR")
|
179
|
+
# Money.new(2000, "USD").exchange_to("EUR") {|x| x.round}
|
180
|
+
# Money.new(2000, "USD").exchange_to(Currency.new("EUR"))
|
181
|
+
# @param other_currency [Currency, String, Symbol] Currency to exchange to.
|
182
|
+
# @return [Money]
|
183
|
+
# @yield [n] Optional block to use when rounding after exchanging one currency
|
184
|
+
# for another.
|
185
|
+
# @yieldparam n [Float] The resulting float after exchanging one currency for
|
186
|
+
# another.
|
187
|
+
# @yieldreturn [Integer]
|
188
|
+
#
|
189
|
+
# source://money//lib/money/money.rb#532
|
190
|
+
def exchange_to(other_currency, &rounding_method); end
|
191
|
+
|
192
|
+
# Creates a formatted price string according to several rules.
|
193
|
+
#
|
194
|
+
# @param rules [Hash] See {Money::Formatter Money::Formatter} for the list of formatting options
|
195
|
+
# @return [String]
|
196
|
+
#
|
197
|
+
# source://money//lib/money/money.rb#627
|
198
|
+
def format(*rules); end
|
199
|
+
|
200
|
+
# The value of the monetary amount represented in the fractional or subunit
|
201
|
+
# of the currency.
|
202
|
+
#
|
203
|
+
# For example, in the US dollar currency the fractional unit is cents, and
|
204
|
+
# there are 100 cents in one US dollar. So given the Money representation of
|
205
|
+
# one US dollar, the fractional interpretation is 100.
|
206
|
+
#
|
207
|
+
# Another example is that of the Kuwaiti dinar. In this case the fractional
|
208
|
+
# unit is the fils and there 1000 fils to one Kuwaiti dinar. So given the
|
209
|
+
# Money representation of one Kuwaiti dinar, the fractional interpretation is
|
210
|
+
# 1000.
|
211
|
+
#
|
212
|
+
# @return [Integer] when infinite_precision is false
|
213
|
+
# @return [BigDecimal] when infinite_precision is true
|
214
|
+
# @see infinite_precision
|
215
|
+
#
|
216
|
+
# source://money//lib/money/money.rb#53
|
217
|
+
def fractional; end
|
218
|
+
|
219
|
+
# Returns a Integer hash value based on the +fractional+ and +currency+ attributes
|
220
|
+
# in order to use functions like & (intersection), group_by, etc.
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
# Money.new(100).hash #=> 908351
|
224
|
+
# @return [Integer]
|
225
|
+
#
|
226
|
+
# source://money//lib/money/money.rb#422
|
227
|
+
def hash; end
|
228
|
+
|
229
|
+
# Common inspect function
|
230
|
+
#
|
231
|
+
# @return [String]
|
232
|
+
#
|
233
|
+
# source://money//lib/money/money.rb#439
|
234
|
+
def inspect; end
|
235
|
+
|
236
|
+
# Round the monetary amount to smallest unit of coinage.
|
237
|
+
#
|
238
|
+
# @example
|
239
|
+
# Money.new(10.1, 'USD').round #=> Money.new(10, 'USD')
|
240
|
+
# @note This method is only useful when operating with infinite_precision turned
|
241
|
+
# on. Without infinite_precision values are rounded to the smallest unit of
|
242
|
+
# coinage automatically.
|
243
|
+
# @return [Money]
|
244
|
+
# @see Money.default_infinite_precision
|
245
|
+
#
|
246
|
+
# source://money//lib/money/money.rb#616
|
247
|
+
def round(rounding_mode = T.unsafe(nil), rounding_precision = T.unsafe(nil)); end
|
248
|
+
|
249
|
+
# Round a given amount of money to the nearest possible amount in cash value. For
|
250
|
+
# example, in Swiss franc (CHF), the smallest possible amount of cash value is
|
251
|
+
# CHF 0.05. Therefore, this method rounds CHF 0.07 to CHF 0.05, and CHF 0.08 to
|
252
|
+
# CHF 0.10.
|
253
|
+
#
|
254
|
+
# @return [Integer] when infinite_precision is false
|
255
|
+
# @return [BigDecimal] when infinite_precision is true
|
256
|
+
# @see infinite_precision
|
257
|
+
#
|
258
|
+
# source://money//lib/money/money.rb#70
|
259
|
+
def round_to_nearest_cash_value; end
|
260
|
+
|
261
|
+
# Splits a given amount in parts without losing pennies. The left-over pennies will be
|
262
|
+
# distributed round-robin amongst the parties. This means that parts listed first will likely
|
263
|
+
# receive more pennies than ones listed later.
|
264
|
+
#
|
265
|
+
# Pass [2, 1, 1] as input to give twice as much to part1 as part2 or
|
266
|
+
# part3 which results in 50% of the cash to party1, 25% to part2, and 25% to part3. Passing a
|
267
|
+
# number instead of an array will split the amount evenly (without losing pennies when rounding).
|
268
|
+
#
|
269
|
+
# @example
|
270
|
+
# Money.new(5, "USD").allocate([3, 7]) #=> [Money.new(2), Money.new(3)]
|
271
|
+
# Money.new(100, "USD").allocate([1, 1, 1]) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
272
|
+
# Money.new(100, "USD").allocate(2) #=> [Money.new(50), Money.new(50)]
|
273
|
+
# Money.new(100, "USD").allocate(3) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
274
|
+
# @param parts [Array<Numeric>, Numeric] how amount should be distributed to parts
|
275
|
+
# @return [Array<Money>]
|
276
|
+
#
|
277
|
+
# source://money//lib/money/money.rb#595
|
278
|
+
def split(parts); end
|
279
|
+
|
280
|
+
# Uses +Currency#symbol+. If +nil+ is returned, defaults to "¤".
|
281
|
+
#
|
282
|
+
# @example
|
283
|
+
# Money.new(100, "USD").symbol #=> "$"
|
284
|
+
# @return [String]
|
285
|
+
#
|
286
|
+
# source://money//lib/money/money.rb#432
|
287
|
+
def symbol; end
|
288
|
+
|
289
|
+
# Returns a thousands separator according to the locale
|
290
|
+
#
|
291
|
+
# @return [String]
|
292
|
+
#
|
293
|
+
# source://money//lib/money/money.rb#635
|
294
|
+
def thousands_separator; end
|
295
|
+
|
296
|
+
# Return the amount of money as a BigDecimal.
|
297
|
+
#
|
298
|
+
# @example
|
299
|
+
# Money.us_dollar(1_00).to_d #=> BigDecimal("1.00")
|
300
|
+
# @return [BigDecimal]
|
301
|
+
#
|
302
|
+
# source://money//lib/money/money.rb#462
|
303
|
+
def to_d; end
|
304
|
+
|
305
|
+
# Return the amount of money as a float. Floating points cannot guarantee
|
306
|
+
# precision. Therefore, this function should only be used when you no longer
|
307
|
+
# need to represent currency or working with another system that requires
|
308
|
+
# floats.
|
309
|
+
#
|
310
|
+
# @example
|
311
|
+
# Money.us_dollar(100).to_f #=> 1.0
|
312
|
+
# @return [Float]
|
313
|
+
#
|
314
|
+
# source://money//lib/money/money.rb#485
|
315
|
+
def to_f; end
|
316
|
+
|
317
|
+
# Return the amount of money as a Integer.
|
318
|
+
#
|
319
|
+
# @example
|
320
|
+
# Money.us_dollar(1_00).to_i #=> 1
|
321
|
+
# @return [Integer]
|
322
|
+
#
|
323
|
+
# source://money//lib/money/money.rb#472
|
324
|
+
def to_i; end
|
325
|
+
|
326
|
+
# Conversion to +self+.
|
327
|
+
#
|
328
|
+
# @return [self]
|
329
|
+
#
|
330
|
+
# source://money//lib/money/money.rb#507
|
331
|
+
def to_money(given_currency = T.unsafe(nil)); end
|
332
|
+
|
333
|
+
# Returns the amount of money as a string.
|
334
|
+
#
|
335
|
+
# @example
|
336
|
+
# Money.ca_dollar(100).to_s #=> "1.00"
|
337
|
+
# @return [String]
|
338
|
+
#
|
339
|
+
# source://money//lib/money/money.rb#449
|
340
|
+
def to_s; end
|
341
|
+
|
342
|
+
# Returns a new Money instance in a given currency leaving the amount intact
|
343
|
+
# and not performing currency conversion.
|
344
|
+
#
|
345
|
+
# @param new_currency [Currency, String, Symbol] Currency of the new object.
|
346
|
+
# @return [self]
|
347
|
+
#
|
348
|
+
# source://money//lib/money/money.rb#495
|
349
|
+
def with_currency(new_currency); end
|
350
|
+
|
351
|
+
private
|
352
|
+
|
353
|
+
# source://money//lib/money/money.rb#659
|
354
|
+
def as_d(num); end
|
355
|
+
|
356
|
+
# source://money//lib/money/money.rb#675
|
357
|
+
def locale_backend; end
|
358
|
+
|
359
|
+
# source://money//lib/money/money.rb#667
|
360
|
+
def return_value(value); end
|
361
|
+
|
362
|
+
class << self
|
363
|
+
# Adds a new exchange rate to the default bank and return the rate.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# Money.add_rate("USD", "CAD", 1.25) #=> 1.25
|
367
|
+
# @param from_currency [Currency, String, Symbol] Currency to exchange from.
|
368
|
+
# @param to_currency [Currency, String, Symbol] Currency to exchange to.
|
369
|
+
# @param rate [Numeric] Rate to exchange with.
|
370
|
+
# @return [Numeric]
|
371
|
+
#
|
372
|
+
# source://money//lib/money/money.rb#282
|
373
|
+
def add_rate(from_currency, to_currency, rate); end
|
374
|
+
|
375
|
+
# Used to specify precision for converting Rational to BigDecimal
|
376
|
+
#
|
377
|
+
# @return [Integer]
|
378
|
+
#
|
379
|
+
# source://money//lib/money/money.rb#132
|
380
|
+
def conversion_precision; end
|
381
|
+
|
382
|
+
# Sets the attribute conversion_precision
|
383
|
+
#
|
384
|
+
# @param value the value to set the attribute conversion_precision to.
|
385
|
+
#
|
386
|
+
# source://money//lib/money/money.rb#132
|
387
|
+
def conversion_precision=(_arg0); end
|
388
|
+
|
389
|
+
# Used to set a default bank for currency exchange.
|
390
|
+
#
|
391
|
+
# Each Money object is associated with a bank
|
392
|
+
# object, which is responsible for currency exchange. This property
|
393
|
+
# allows you to specify the default bank object. The default value for
|
394
|
+
# this property is an instance of +Bank::VariableExchange.+ It allows
|
395
|
+
# one to specify custom exchange rates.
|
396
|
+
#
|
397
|
+
# @return [Money::Bank::Base]
|
398
|
+
#
|
399
|
+
# source://money//lib/money/money.rb#171
|
400
|
+
def default_bank; end
|
401
|
+
|
402
|
+
# Used to set a default bank for currency exchange.
|
403
|
+
#
|
404
|
+
# Each Money object is associated with a bank
|
405
|
+
# object, which is responsible for currency exchange. This property
|
406
|
+
# allows you to specify the default bank object. The default value for
|
407
|
+
# this property is an instance of +Bank::VariableExchange.+ It allows
|
408
|
+
# one to specify custom exchange rates.
|
409
|
+
#
|
410
|
+
# @return [Money::Bank::Base]
|
411
|
+
#
|
412
|
+
# source://money//lib/money/money.rb#134
|
413
|
+
def default_bank=(_arg0); end
|
414
|
+
|
415
|
+
# source://money//lib/money/money.rb#152
|
416
|
+
def default_currency; end
|
417
|
+
|
418
|
+
# source://money//lib/money/money.rb#166
|
419
|
+
def default_currency=(currency); end
|
420
|
+
|
421
|
+
# Used to define a default hash of rules for every time
|
422
|
+
# +Money#format+ is called. Rules provided on method call will be
|
423
|
+
# merged with the default ones. To overwrite a rule, just provide the
|
424
|
+
# intended value while calling +format+.
|
425
|
+
#
|
426
|
+
# @example
|
427
|
+
# Money.default_formatting_rules = { display_free: true }
|
428
|
+
# Money.new(0, "USD").format # => "free"
|
429
|
+
# Money.new(0, "USD").format(display_free: false) # => "$0.00"
|
430
|
+
# @return [Hash]
|
431
|
+
# @see Money::Formatter#initialize Money::Formatter for more details
|
432
|
+
#
|
433
|
+
# source://money//lib/money/money.rb#132
|
434
|
+
def default_formatting_rules; end
|
435
|
+
|
436
|
+
# Used to define a default hash of rules for every time
|
437
|
+
# +Money#format+ is called. Rules provided on method call will be
|
438
|
+
# merged with the default ones. To overwrite a rule, just provide the
|
439
|
+
# intended value while calling +format+.
|
440
|
+
#
|
441
|
+
# @example
|
442
|
+
# Money.default_formatting_rules = { display_free: true }
|
443
|
+
# Money.new(0, "USD").format # => "free"
|
444
|
+
# Money.new(0, "USD").format(display_free: false) # => "$0.00"
|
445
|
+
# @return [Hash]
|
446
|
+
# @see Money::Formatter#initialize Money::Formatter for more details
|
447
|
+
#
|
448
|
+
# source://money//lib/money/money.rb#132
|
449
|
+
def default_formatting_rules=(_arg0); end
|
450
|
+
|
451
|
+
# @return [Boolean] Use this to enable infinite precision cents as the
|
452
|
+
# global default
|
453
|
+
#
|
454
|
+
# source://money//lib/money/money.rb#132
|
455
|
+
def default_infinite_precision; end
|
456
|
+
|
457
|
+
# @return [Boolean] Use this to enable infinite precision cents as the
|
458
|
+
# global default
|
459
|
+
#
|
460
|
+
# source://money//lib/money/money.rb#132
|
461
|
+
def default_infinite_precision=(_arg0); end
|
462
|
+
|
463
|
+
# Sets the default bank to be a SingleCurrency bank that raises on
|
464
|
+
# currency exchange. Useful when apps operate in a single currency at a time.
|
465
|
+
#
|
466
|
+
# source://money//lib/money/money.rb#288
|
467
|
+
def disallow_currency_conversion!; end
|
468
|
+
|
469
|
+
# Creates a new Money object of value given in the +unit+ of the given
|
470
|
+
# +currency+.
|
471
|
+
#
|
472
|
+
# @example
|
473
|
+
# Money.from_amount(23.45, "USD") # => #<Money fractional:2345 currency:USD>
|
474
|
+
# Money.from_amount(23.45, "JPY") # => #<Money fractional:23 currency:JPY>
|
475
|
+
# @option [Money::Bank::*]
|
476
|
+
# @param amount [Numeric] The numerical value of the money.
|
477
|
+
# @param currency [Currency, String, Symbol] The currency format.
|
478
|
+
# @param options [Hash] Optional settings for the new Money instance
|
479
|
+
# @param [Money::Bank::*] [Hash] a customizable set of options
|
480
|
+
# @raise [ArgumentError]
|
481
|
+
# @return [Money]
|
482
|
+
# @see #initialize
|
483
|
+
#
|
484
|
+
# source://money//lib/money/money.rb#307
|
485
|
+
def from_amount(amount, currency = T.unsafe(nil), options = T.unsafe(nil)); end
|
486
|
+
|
487
|
+
def from_cents(*_arg0); end
|
488
|
+
|
489
|
+
# Creates a new Money object of value given in the +unit+ of the given
|
490
|
+
# +currency+.
|
491
|
+
#
|
492
|
+
# @example
|
493
|
+
# Money.from_amount(23.45, "USD") # => #<Money fractional:2345 currency:USD>
|
494
|
+
# Money.from_amount(23.45, "JPY") # => #<Money fractional:23 currency:JPY>
|
495
|
+
# @option [Money::Bank::*]
|
496
|
+
# @param amount [Numeric] The numerical value of the money.
|
497
|
+
# @param currency [Currency, String, Symbol] The currency format.
|
498
|
+
# @param options [Hash] Optional settings for the new Money instance
|
499
|
+
# @param [Money::Bank::*] [Hash] a customizable set of options
|
500
|
+
# @raise [ArgumentError]
|
501
|
+
# @return [Money]
|
502
|
+
# @see #initialize
|
503
|
+
#
|
504
|
+
# source://money//lib/money/money.rb#307
|
505
|
+
def from_dollars(amount, currency = T.unsafe(nil), options = T.unsafe(nil)); end
|
506
|
+
|
507
|
+
# source://money//lib/money/money.rb#136
|
508
|
+
def infinite_precision; end
|
509
|
+
|
510
|
+
# source://money//lib/money/money.rb#141
|
511
|
+
def infinite_precision=(value); end
|
512
|
+
|
513
|
+
# @private
|
514
|
+
#
|
515
|
+
# source://money//lib/money/money.rb#224
|
516
|
+
def inherited(base); end
|
517
|
+
|
518
|
+
# Returns the value of attribute locale_backend.
|
519
|
+
#
|
520
|
+
# source://money//lib/money/money.rb#133
|
521
|
+
def locale_backend; end
|
522
|
+
|
523
|
+
# source://money//lib/money/money.rb#179
|
524
|
+
def locale_backend=(value); end
|
525
|
+
|
526
|
+
# Use this to return the rounding mode.
|
527
|
+
#
|
528
|
+
# @param mode [BigDecimal::ROUND_MODE]
|
529
|
+
# @return [BigDecimal::ROUND_MODE] rounding mode
|
530
|
+
#
|
531
|
+
# source://money//lib/money/money.rb#235
|
532
|
+
def rounding_mode(mode = T.unsafe(nil)); end
|
533
|
+
|
534
|
+
# @attr_writer rounding_mode Use this to specify the rounding mode
|
535
|
+
#
|
536
|
+
# source://money//lib/money/money.rb#184
|
537
|
+
def rounding_mode=(new_rounding_mode); end
|
538
|
+
|
539
|
+
# source://money//lib/money/money.rb#199
|
540
|
+
def setup_defaults; end
|
541
|
+
|
542
|
+
# Used to disable i18n even if it's used by other components of your app.
|
543
|
+
#
|
544
|
+
# @return [Boolean]
|
545
|
+
#
|
546
|
+
# source://money//lib/money/money.rb#133
|
547
|
+
def use_i18n; end
|
548
|
+
|
549
|
+
# Used to disable i18n even if it's used by other components of your app.
|
550
|
+
#
|
551
|
+
# @return [Boolean]
|
552
|
+
#
|
553
|
+
# source://money//lib/money/money.rb#189
|
554
|
+
def use_i18n=(value); end
|
555
|
+
|
556
|
+
# Temporarily changes the rounding mode in a given block.
|
557
|
+
#
|
558
|
+
# @example
|
559
|
+
# fee = Money.with_rounding_mode(BigDecimal::ROUND_HALF_UP) do
|
560
|
+
# Money.new(1200) * BigDecimal('0.029')
|
561
|
+
# end
|
562
|
+
# @param mode [BigDecimal::ROUND_MODE]
|
563
|
+
# @return [Object] block results
|
564
|
+
# @yield The block within which rounding mode will be changed. Its return
|
565
|
+
# value will also be the return value of the whole method.
|
566
|
+
#
|
567
|
+
# source://money//lib/money/money.rb#265
|
568
|
+
def with_rounding_mode(mode); end
|
569
|
+
end
|
570
|
+
end
|
571
|
+
|
572
|
+
# source://money//lib/money/money/allocation.rb#4
|
573
|
+
class Money::Allocation
|
574
|
+
class << self
|
575
|
+
# Converts a given number to BigDecimal.
|
576
|
+
# This method supports inputs of BigDecimal, Rational, and other numeric types by ensuring they are all returned
|
577
|
+
# as BigDecimal instances for consistent handling.
|
578
|
+
#
|
579
|
+
# @param number [Numeric, BigDecimal, Rational] The number to convert.
|
580
|
+
# @return [BigDecimal] The converted number as a BigDecimal.
|
581
|
+
#
|
582
|
+
# source://money//lib/money/money/allocation.rb#58
|
583
|
+
def convert_to_big_decimal(number); end
|
584
|
+
|
585
|
+
# Splits a given amount in parts. The allocation is based on the parts' proportions
|
586
|
+
# or evenly if parts are numerically specified.
|
587
|
+
#
|
588
|
+
# The results should always add up to the original amount.
|
589
|
+
#
|
590
|
+
# @param amount [Numeric] The total amount to be allocated.
|
591
|
+
# @param parts [Numeric, Array<Numeric>] Number of parts to split into or an array (proportions for allocation)
|
592
|
+
# @param whole_amounts [Boolean] Specifies whether to allocate whole amounts only. Defaults to true.
|
593
|
+
# @raise [ArgumentError] If parts is empty or not provided.
|
594
|
+
# @return [Array<Numeric>] An array containing the allocated amounts.
|
595
|
+
#
|
596
|
+
# source://money//lib/money/money/allocation.rb#16
|
597
|
+
def generate(amount, parts, whole_amounts = T.unsafe(nil)); end
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
601
|
+
# source://money//lib/money/money/arithmetic.rb#2
|
602
|
+
module Money::Arithmetic
|
603
|
+
# Synonym for +#modulo+.
|
604
|
+
#
|
605
|
+
# @param val [Money, Integer] Number take modulo with.
|
606
|
+
# @return [Money]
|
607
|
+
# @see #modulo
|
608
|
+
#
|
609
|
+
# source://money//lib/money/money/arithmetic.rb#264
|
610
|
+
def %(val); end
|
611
|
+
|
612
|
+
# Multiplies the monetary value with the given number and returns a new
|
613
|
+
# +Money+ object with this monetary value and the same currency.
|
614
|
+
#
|
615
|
+
# Note that you can't multiply a Money object by an other +Money+ object.
|
616
|
+
#
|
617
|
+
# @example
|
618
|
+
# Money.new(100) * 2 #=> #<Money @fractional=200>
|
619
|
+
# @param value [Numeric] Number to multiply by.
|
620
|
+
# @raise [TypeError] If +value+ is NOT a number.
|
621
|
+
# @return [Money] The resulting money.
|
622
|
+
#
|
623
|
+
# source://money//lib/money/money/arithmetic.rb#167
|
624
|
+
def *(value); end
|
625
|
+
|
626
|
+
# Returns a new Money object containing the sum of the two operands' monetary
|
627
|
+
# values. If +other_money+ has a different currency then its monetary value
|
628
|
+
# is automatically exchanged to this object's currency using +exchange_to+.
|
629
|
+
#
|
630
|
+
# Returns a new Money object containing the difference between the two
|
631
|
+
# operands' monetary values. If +other_money+ has a different currency then
|
632
|
+
# its monetary value is automatically exchanged to this object's currency
|
633
|
+
# using +exchange_to+.
|
634
|
+
#
|
635
|
+
# @example
|
636
|
+
# Money.new(100) + Money.new(100) #=> #<Money @fractional=200>
|
637
|
+
# @example
|
638
|
+
# Money.new(100) - Money.new(99) #=> #<Money @fractional=1>
|
639
|
+
# @param other [Money] Other +Money+ object to add.
|
640
|
+
# @param other [Money] Other +Money+ object to subtract.
|
641
|
+
# @return [Money]
|
642
|
+
# @return [Money]
|
643
|
+
#
|
644
|
+
# source://money//lib/money/money/arithmetic.rb#135
|
645
|
+
def +(other); end
|
646
|
+
|
647
|
+
# Returns a new Money object containing the sum of the two operands' monetary
|
648
|
+
# values. If +other_money+ has a different currency then its monetary value
|
649
|
+
# is automatically exchanged to this object's currency using +exchange_to+.
|
650
|
+
#
|
651
|
+
# Returns a new Money object containing the difference between the two
|
652
|
+
# operands' monetary values. If +other_money+ has a different currency then
|
653
|
+
# its monetary value is automatically exchanged to this object's currency
|
654
|
+
# using +exchange_to+.
|
655
|
+
#
|
656
|
+
# @example
|
657
|
+
# Money.new(100) + Money.new(100) #=> #<Money @fractional=200>
|
658
|
+
# @example
|
659
|
+
# Money.new(100) - Money.new(99) #=> #<Money @fractional=1>
|
660
|
+
# @param other [Money] Other +Money+ object to add.
|
661
|
+
# @param other [Money] Other +Money+ object to subtract.
|
662
|
+
# @return [Money]
|
663
|
+
# @return [Money]
|
664
|
+
#
|
665
|
+
# source://money//lib/money/money/arithmetic.rb#135
|
666
|
+
def -(other); end
|
667
|
+
|
668
|
+
# Returns a money object with changed polarity.
|
669
|
+
#
|
670
|
+
# @example
|
671
|
+
# - Money.new(100) #=> #<Money @fractional=-100>
|
672
|
+
# @return [Money]
|
673
|
+
#
|
674
|
+
# source://money//lib/money/money/arithmetic.rb#18
|
675
|
+
def -@; end
|
676
|
+
|
677
|
+
# Divides the monetary value with the given number and returns a new +Money+
|
678
|
+
# object with this monetary value and the same currency.
|
679
|
+
# Can also divide by another +Money+ object to get a ratio.
|
680
|
+
#
|
681
|
+
# +Money/Numeric+ returns +Money+. +Money/Money+ returns +Float+.
|
682
|
+
#
|
683
|
+
# @example
|
684
|
+
# Money.new(100) / 10 #=> #<Money @fractional=10>
|
685
|
+
# Money.new(100) / Money.new(10) #=> 10.0
|
686
|
+
# @param value [Money, Numeric] Number to divide by.
|
687
|
+
# @return [Money] The resulting money if you divide Money by a number.
|
688
|
+
# @return [Float] The resulting number if you divide Money by a Money.
|
689
|
+
#
|
690
|
+
# source://money//lib/money/money/arithmetic.rb#191
|
691
|
+
def /(value); end
|
692
|
+
|
693
|
+
# Compares two Money objects. If money objects have a different currency it
|
694
|
+
# will attempt to convert the currency.
|
695
|
+
#
|
696
|
+
# @param other [Money] Value to compare with.
|
697
|
+
# @raise [TypeError] when other object is not Money
|
698
|
+
# @return [Integer]
|
699
|
+
#
|
700
|
+
# source://money//lib/money/money/arithmetic.rb#55
|
701
|
+
def <=>(other); end
|
702
|
+
|
703
|
+
# Uses Comparable's implementation but raises ArgumentError if non-zero
|
704
|
+
# numeric value is given.
|
705
|
+
#
|
706
|
+
# source://money//lib/money/money/arithmetic.rb#73
|
707
|
+
def ==(other); end
|
708
|
+
|
709
|
+
# Return absolute value of self as a new Money object.
|
710
|
+
#
|
711
|
+
# @example
|
712
|
+
# Money.new(-100).abs #=> #<Money @fractional=100>
|
713
|
+
# @return [Money]
|
714
|
+
#
|
715
|
+
# source://money//lib/money/money/arithmetic.rb#294
|
716
|
+
def abs; end
|
717
|
+
|
718
|
+
# Used to make Money instance handle the operations when arguments order is reversed
|
719
|
+
#
|
720
|
+
# @example
|
721
|
+
# 2 * Money.new(10) #=> #<Money @fractional=20>
|
722
|
+
# @return [Array]
|
723
|
+
#
|
724
|
+
# source://money//lib/money/money/arithmetic.rb#326
|
725
|
+
def coerce(other); end
|
726
|
+
|
727
|
+
# Synonym for +#/+.
|
728
|
+
#
|
729
|
+
# @param value [Money, Numeric] Number to divide by.
|
730
|
+
# @return [Money] The resulting money if you divide Money by a number.
|
731
|
+
# @return [Float] The resulting number if you divide Money by a Money.
|
732
|
+
# @see #/
|
733
|
+
#
|
734
|
+
# source://money//lib/money/money/arithmetic.rb#209
|
735
|
+
def div(value); end
|
736
|
+
|
737
|
+
# Divide money by money or fixnum and return array containing quotient and
|
738
|
+
# modulus.
|
739
|
+
#
|
740
|
+
# @example
|
741
|
+
# Money.new(100).divmod(9) #=> [#<Money @fractional=11>, #<Money @fractional=1>]
|
742
|
+
# Money.new(100).divmod(Money.new(9)) #=> [11, #<Money @fractional=1>]
|
743
|
+
# @param val [Money, Integer] Number to divmod by.
|
744
|
+
# @return [Array<Money,Money>, Array<Integer,Money>]
|
745
|
+
#
|
746
|
+
# source://money//lib/money/money/arithmetic.rb#223
|
747
|
+
def divmod(val); end
|
748
|
+
|
749
|
+
# Checks whether two Money objects have the same currency and the same
|
750
|
+
# amount. If Money objects have a different currency it will only be true
|
751
|
+
# if the amounts are both zero. Checks against objects that are not Money or
|
752
|
+
# a subclass will always return false.
|
753
|
+
#
|
754
|
+
# @example
|
755
|
+
# Money.new(100).eql?(Money.new(101)) #=> false
|
756
|
+
# Money.new(100).eql?(Money.new(100)) #=> true
|
757
|
+
# Money.new(100, "USD").eql?(Money.new(100, "GBP")) #=> false
|
758
|
+
# Money.new(0, "USD").eql?(Money.new(0, "EUR")) #=> true
|
759
|
+
# Money.new(100).eql?("1.00") #=> false
|
760
|
+
# @param other_money [Money] Value to compare with.
|
761
|
+
# @return [Boolean]
|
762
|
+
#
|
763
|
+
# source://money//lib/money/money/arithmetic.rb#37
|
764
|
+
def eql?(other_money); end
|
765
|
+
|
766
|
+
# Equivalent to +self.divmod(val)[1]+
|
767
|
+
#
|
768
|
+
# @example
|
769
|
+
# Money.new(100).modulo(9) #=> #<Money @fractional=1>
|
770
|
+
# Money.new(100).modulo(Money.new(9)) #=> #<Money @fractional=1>
|
771
|
+
# @param val [Money, Integer] Number take modulo with.
|
772
|
+
# @return [Money]
|
773
|
+
#
|
774
|
+
# source://money//lib/money/money/arithmetic.rb#253
|
775
|
+
def modulo(val); end
|
776
|
+
|
777
|
+
# Test if the amount is negative. Returns +true+ if the money amount is
|
778
|
+
# less than 0, +false+ otherwise.
|
779
|
+
#
|
780
|
+
# @example
|
781
|
+
# Money.new(-1).negative? #=> true
|
782
|
+
# Money.new(0).negative? #=> false
|
783
|
+
# Money.new(1).negative? #=> false
|
784
|
+
# @return [Boolean]
|
785
|
+
#
|
786
|
+
# source://money//lib/money/money/arithmetic.rb#102
|
787
|
+
def negative?; end
|
788
|
+
|
789
|
+
# Test if the money amount is non-zero. Returns this money object if it is
|
790
|
+
# non-zero, or nil otherwise, like +Numeric#nonzero?+.
|
791
|
+
#
|
792
|
+
# @example
|
793
|
+
# Money.new(100).nonzero? #=> #<Money @fractional=100>
|
794
|
+
# Money.new(0).nonzero? #=> nil
|
795
|
+
# @return [Money, nil]
|
796
|
+
#
|
797
|
+
# source://money//lib/money/money/arithmetic.rb#317
|
798
|
+
def nonzero?; end
|
799
|
+
|
800
|
+
# Test if the amount is positive. Returns +true+ if the money amount is
|
801
|
+
# greater than 0, +false+ otherwise.
|
802
|
+
#
|
803
|
+
# @example
|
804
|
+
# Money.new(1).positive? #=> true
|
805
|
+
# Money.new(0).positive? #=> false
|
806
|
+
# Money.new(-1).positive? #=> false
|
807
|
+
# @return [Boolean]
|
808
|
+
#
|
809
|
+
# source://money//lib/money/money/arithmetic.rb#89
|
810
|
+
def positive?; end
|
811
|
+
|
812
|
+
# If different signs +self.modulo(val) - val+ otherwise +self.modulo(val)+
|
813
|
+
#
|
814
|
+
# @example
|
815
|
+
# Money.new(100).remainder(9) #=> #<Money @fractional=1>
|
816
|
+
# @param val [Money, Integer] Number to rake remainder with.
|
817
|
+
# @return [Money]
|
818
|
+
#
|
819
|
+
# source://money//lib/money/money/arithmetic.rb#276
|
820
|
+
def remainder(val); end
|
821
|
+
|
822
|
+
# Test if the money amount is zero.
|
823
|
+
#
|
824
|
+
# @example
|
825
|
+
# Money.new(100).zero? #=> false
|
826
|
+
# Money.new(0).zero? #=> true
|
827
|
+
# @return [Boolean]
|
828
|
+
#
|
829
|
+
# source://money//lib/money/money/arithmetic.rb#305
|
830
|
+
def zero?; end
|
831
|
+
|
832
|
+
private
|
833
|
+
|
834
|
+
# source://money//lib/money/money/arithmetic.rb#231
|
835
|
+
def divmod_money(val); end
|
836
|
+
|
837
|
+
# source://money//lib/money/money/arithmetic.rb#238
|
838
|
+
def divmod_other(val); end
|
839
|
+
end
|
840
|
+
|
841
|
+
# Wrapper for coerced numeric values to distinguish
|
842
|
+
# when numeric was on the 1st place in operation.
|
843
|
+
#
|
844
|
+
# source://money//lib/money/money/arithmetic.rb#5
|
845
|
+
class Money::Arithmetic::CoercedNumeric < ::Struct
|
846
|
+
# Returns the value of attribute value
|
847
|
+
#
|
848
|
+
# @return [Object] the current value of value
|
849
|
+
def value; end
|
850
|
+
|
851
|
+
# Sets the attribute value
|
852
|
+
#
|
853
|
+
# @param value [Object] the value to set the attribute value to.
|
854
|
+
# @return [Object] the newly set value
|
855
|
+
def value=(_); end
|
856
|
+
|
857
|
+
# Proxy #zero? method to skip unnecessary typecasts. See #- and #+.
|
858
|
+
#
|
859
|
+
# @return [Boolean]
|
860
|
+
#
|
861
|
+
# source://money//lib/money/money/arithmetic.rb#7
|
862
|
+
def zero?; end
|
863
|
+
|
864
|
+
class << self
|
865
|
+
def [](*_arg0); end
|
866
|
+
def inspect; end
|
867
|
+
def keyword_init?; end
|
868
|
+
def members; end
|
869
|
+
def new(*_arg0); end
|
870
|
+
end
|
871
|
+
end
|
872
|
+
|
873
|
+
# Provides classes that aid in the ability of exchange one currency with
|
874
|
+
# another.
|
875
|
+
#
|
876
|
+
# source://money//lib/money/bank/base.rb#4
|
877
|
+
module Money::Bank; end
|
878
|
+
|
879
|
+
# Money::Bank::Base is the basic interface for creating a money exchange
|
880
|
+
# object, also called Bank.
|
881
|
+
#
|
882
|
+
# A Bank is responsible for storing exchange rates, take a Money object as
|
883
|
+
# input and returns the corresponding Money object converted into an other
|
884
|
+
# currency.
|
885
|
+
#
|
886
|
+
# This class exists for aiding in the creating of other classes to exchange
|
887
|
+
# money between different currencies. When creating a subclass you will
|
888
|
+
# need to implement the following methods to exchange money between
|
889
|
+
# currencies:
|
890
|
+
#
|
891
|
+
# - #exchange_with(Money) #=> Money
|
892
|
+
#
|
893
|
+
# See Money::Bank::VariableExchange for a real example.
|
894
|
+
#
|
895
|
+
# Also, you can extend +Money::Bank::VariableExchange+ instead of
|
896
|
+
# +Money::Bank::Base+ if your bank implementation needs to store rates
|
897
|
+
# internally.
|
898
|
+
#
|
899
|
+
# @abstract Subclass and override +#exchange_with+ to implement a custom
|
900
|
+
# +Money::Bank+ class. You can also override +#setup+ instead of
|
901
|
+
# +#initialize+ to setup initial variables, etc.
|
902
|
+
#
|
903
|
+
# source://money//lib/money/bank/base.rb#40
|
904
|
+
class Money::Bank::Base
|
905
|
+
# Initializes a new +Money::Bank::Base+ object. An optional block can be
|
906
|
+
# passed to dictate the rounding method that +#exchange_with+ can use.
|
907
|
+
#
|
908
|
+
# @example
|
909
|
+
# Money::Bank::Base.new #=> #<Money::Bank::Base @rounding_method=nil>
|
910
|
+
# Money::Bank::Base.new {|n|
|
911
|
+
# n.floor
|
912
|
+
# } #=> #<Money::Bank::Base @round_method=#<Proc>>
|
913
|
+
# @return [Money::Bank::Base]
|
914
|
+
# @yield [n] Optional block to use when rounding after exchanging one
|
915
|
+
# currency for another.
|
916
|
+
# @yieldparam n [Float] The resulting float after exchanging one currency
|
917
|
+
# for another.
|
918
|
+
# @yieldreturn [Integer]
|
919
|
+
#
|
920
|
+
# source://money//lib/money/bank/base.rb#70
|
921
|
+
def initialize(&block); end
|
922
|
+
|
923
|
+
# Exchanges the given +Money+ object to a new +Money+ object in
|
924
|
+
# +to_currency+.
|
925
|
+
#
|
926
|
+
# @abstract Subclass and override +#exchange_with+ to implement a custom
|
927
|
+
# +Money::Bank+ class.
|
928
|
+
# @param from [Money] The +Money+ object to exchange from.
|
929
|
+
# @param to_currency [Money::Currency, String, Symbol] The currency
|
930
|
+
# string or object to exchange to.
|
931
|
+
# @raise NotImplementedError
|
932
|
+
# @return [Money]
|
933
|
+
# @yield [n] Optional block to use to round the result after making
|
934
|
+
# the exchange.
|
935
|
+
# @yieldparam n [Float] The result after exchanging from one currency to
|
936
|
+
# the other.
|
937
|
+
# @yieldreturn [Integer]
|
938
|
+
#
|
939
|
+
# source://money//lib/money/bank/base.rb#103
|
940
|
+
def exchange_with(from, to_currency, &block); end
|
941
|
+
|
942
|
+
# The rounding method to use when exchanging rates.
|
943
|
+
#
|
944
|
+
# @return [Proc]
|
945
|
+
#
|
946
|
+
# source://money//lib/money/bank/base.rb#52
|
947
|
+
def rounding_method; end
|
948
|
+
|
949
|
+
# Given two currency strings or object, checks whether they're both the
|
950
|
+
# same currency. Return +true+ if the currencies are the same, +false+
|
951
|
+
# otherwise.
|
952
|
+
#
|
953
|
+
# @example
|
954
|
+
# same_currency?("usd", "USD") #=> true
|
955
|
+
# same_currency?("usd", "EUR") #=> false
|
956
|
+
# same_currency?("usd", Currency.new("USD")) #=> true
|
957
|
+
# same_currency?("usd", "USD") #=> true
|
958
|
+
# @param currency1 [Money::Currency, String, Symbol] The first currency
|
959
|
+
# to compare.
|
960
|
+
# @param currency2 [Money::Currency, String, Symbol] The second currency
|
961
|
+
# to compare.
|
962
|
+
# @return [Boolean]
|
963
|
+
#
|
964
|
+
# source://money//lib/money/bank/base.rb#123
|
965
|
+
def same_currency?(currency1, currency2); end
|
966
|
+
|
967
|
+
# Called after initialize. Subclasses can use this method to setup
|
968
|
+
# variables, etc that they normally would in +#initialize+.
|
969
|
+
#
|
970
|
+
# @abstract Subclass and override +#setup+ to implement a custom
|
971
|
+
# +Money::Bank+ class.
|
972
|
+
# @return [self]
|
973
|
+
#
|
974
|
+
# source://money//lib/money/bank/base.rb#82
|
975
|
+
def setup; end
|
976
|
+
|
977
|
+
class << self
|
978
|
+
# Returns the singleton instance of the Base bank.
|
979
|
+
#
|
980
|
+
# @return [Money::Bank::Base]
|
981
|
+
#
|
982
|
+
# source://money//lib/money/bank/base.rb#45
|
983
|
+
def instance; end
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
# Raised when trying to exchange currencies
|
988
|
+
#
|
989
|
+
# source://money//lib/money/bank/single_currency.rb#6
|
990
|
+
class Money::Bank::DifferentCurrencyError < ::Money::Bank::Error; end
|
991
|
+
|
992
|
+
# The lowest Money::Bank error class.
|
993
|
+
# All Money::Bank errors should inherit from it.
|
994
|
+
#
|
995
|
+
# source://money//lib/money/bank/base.rb#8
|
996
|
+
class Money::Bank::Error < ::StandardError; end
|
997
|
+
|
998
|
+
# Class to ensure client code is operating in a single currency
|
999
|
+
# by raising if an exchange attempts to happen.
|
1000
|
+
#
|
1001
|
+
# This is useful when an application uses multiple currencies but
|
1002
|
+
# it usually deals with only one currency at a time so any arithmetic
|
1003
|
+
# where exchanges happen are erroneous. Using this as the default bank
|
1004
|
+
# means that that these mistakes don't silently do the wrong thing.
|
1005
|
+
#
|
1006
|
+
# source://money//lib/money/bank/single_currency.rb#15
|
1007
|
+
class Money::Bank::SingleCurrency < ::Money::Bank::Base
|
1008
|
+
# Raises a DifferentCurrencyError to remove possibility of accidentally
|
1009
|
+
# exchanging currencies
|
1010
|
+
#
|
1011
|
+
# @raise [DifferentCurrencyError]
|
1012
|
+
#
|
1013
|
+
# source://money//lib/money/bank/single_currency.rb#19
|
1014
|
+
def exchange_with(from, to_currency, &block); end
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
# Raised when the bank doesn't know about the conversion rate
|
1018
|
+
# for specified currencies.
|
1019
|
+
#
|
1020
|
+
# source://money//lib/money/bank/base.rb#13
|
1021
|
+
class Money::Bank::UnknownRate < ::Money::Bank::Error; end
|
1022
|
+
|
1023
|
+
# Thrown when an unknown rate format is requested.
|
1024
|
+
#
|
1025
|
+
# source://money//lib/money/bank/variable_exchange.rb#9
|
1026
|
+
class Money::Bank::UnknownRateFormat < ::StandardError; end
|
1027
|
+
|
1028
|
+
# Class for aiding in exchanging money between different currencies. By
|
1029
|
+
# default, the +Money+ class uses an object of this class (accessible
|
1030
|
+
# through +Money#bank+) for performing currency exchanges.
|
1031
|
+
#
|
1032
|
+
# By default, +Money::Bank::VariableExchange+ has no knowledge about
|
1033
|
+
# conversion rates. One must manually specify them with +add_rate+, after
|
1034
|
+
# which one can perform exchanges with +#exchange_with+.
|
1035
|
+
#
|
1036
|
+
# Exchange rates are stored in memory using +Money::RatesStore::Memory+ by default.
|
1037
|
+
# Pass custom rates stores for other types of storage (file, database, etc)
|
1038
|
+
#
|
1039
|
+
# @example
|
1040
|
+
# bank = Money::Bank::VariableExchange.new
|
1041
|
+
# bank.add_rate("USD", "CAD", 1.24515)
|
1042
|
+
# bank.add_rate("CAD", "USD", 0.803115)
|
1043
|
+
#
|
1044
|
+
# c1 = Money.new(100_00, "USD")
|
1045
|
+
# c2 = Money.new(100_00, "CAD")
|
1046
|
+
#
|
1047
|
+
# # Exchange 100 USD to CAD:
|
1048
|
+
# bank.exchange_with(c1, "CAD") #=> #<Money fractional:12451 currency:CAD>
|
1049
|
+
#
|
1050
|
+
# # Exchange 100 CAD to USD:
|
1051
|
+
# bank.exchange_with(c2, "USD") #=> #<Money fractional:8031 currency:USD>
|
1052
|
+
#
|
1053
|
+
# # With custom exchange rates storage
|
1054
|
+
# redis_store = MyCustomRedisStore.new(host: 'localhost:6379')
|
1055
|
+
# bank = Money::Bank::VariableExchange.new(redis_store)
|
1056
|
+
# # Store rates in redis
|
1057
|
+
# bank.add_rate 'USD', 'CAD', 0.98
|
1058
|
+
# # Get rate from redis
|
1059
|
+
# bank.get_rate 'USD', 'CAD'
|
1060
|
+
#
|
1061
|
+
# source://money//lib/money/bank/variable_exchange.rb#43
|
1062
|
+
class Money::Bank::VariableExchange < ::Money::Bank::Base
|
1063
|
+
# Initializes a new +Money::Bank::VariableExchange+ object.
|
1064
|
+
# It defaults to using an in-memory, thread safe store instance for
|
1065
|
+
# storing exchange rates.
|
1066
|
+
#
|
1067
|
+
# @param st [RateStore] An exchange rate store, used to persist exchange rate pairs.
|
1068
|
+
# @return [VariableExchange] a new instance of VariableExchange
|
1069
|
+
# @yield [n] Optional block to use when rounding after exchanging one
|
1070
|
+
# currency for another. See +Money::bank::base+
|
1071
|
+
#
|
1072
|
+
# source://money//lib/money/bank/variable_exchange.rb#59
|
1073
|
+
def initialize(st = T.unsafe(nil), &block); end
|
1074
|
+
|
1075
|
+
# Registers a conversion rate and returns it (uses +#set_rate+).
|
1076
|
+
# Delegates to +Money::RatesStore::Memory+
|
1077
|
+
#
|
1078
|
+
# @example
|
1079
|
+
# bank = Money::Bank::VariableExchange.new
|
1080
|
+
# bank.add_rate("USD", "CAD", 1.24515)
|
1081
|
+
# bank.add_rate("CAD", "USD", 0.803115)
|
1082
|
+
# @param from [Currency, String, Symbol] Currency to exchange from.
|
1083
|
+
# @param to [Currency, String, Symbol] Currency to exchange to.
|
1084
|
+
# @param rate [Numeric] Rate to use when exchanging currencies.
|
1085
|
+
# @return [Numeric]
|
1086
|
+
#
|
1087
|
+
# source://money//lib/money/bank/variable_exchange.rb#158
|
1088
|
+
def add_rate(from, to, rate); end
|
1089
|
+
|
1090
|
+
# source://money//lib/money/bank/variable_exchange.rb#127
|
1091
|
+
def calculate_fractional(from, to_currency); end
|
1092
|
+
|
1093
|
+
# source://money//lib/money/bank/variable_exchange.rb#134
|
1094
|
+
def exchange(fractional, rate, &block); end
|
1095
|
+
|
1096
|
+
# Exchanges the given +Money+ object to a new +Money+ object in
|
1097
|
+
# +to_currency+.
|
1098
|
+
#
|
1099
|
+
# @example
|
1100
|
+
# bank = Money::Bank::VariableExchange.new
|
1101
|
+
# bank.add_rate("USD", "CAD", 1.24515)
|
1102
|
+
# bank.add_rate("CAD", "USD", 0.803115)
|
1103
|
+
#
|
1104
|
+
# c1 = Money.new(100_00, "USD")
|
1105
|
+
# c2 = Money.new(100_00, "CAD")
|
1106
|
+
#
|
1107
|
+
# # Exchange 100 USD to CAD:
|
1108
|
+
# bank.exchange_with(c1, "CAD") #=> #<Money fractional:12451 currency:CAD>
|
1109
|
+
#
|
1110
|
+
# # Exchange 100 CAD to USD:
|
1111
|
+
# bank.exchange_with(c2, "USD") #=> #<Money fractional:8031 currency:USD>
|
1112
|
+
# @param from [Money] The +Money+ object to exchange.
|
1113
|
+
# @param to_currency [Currency, String, Symbol] The currency to exchange to.
|
1114
|
+
# @raise +Money::Bank::UnknownRate+ if the conversion rate is unknown.
|
1115
|
+
# @return [Money]
|
1116
|
+
# @yield [n] Optional block to use when rounding after exchanging one
|
1117
|
+
# currency for another.
|
1118
|
+
# @yieldparam n [Float] The resulting float after exchanging one currency
|
1119
|
+
# for another.
|
1120
|
+
# @yieldreturn [Integer]
|
1121
|
+
#
|
1122
|
+
# source://money//lib/money/bank/variable_exchange.rb#109
|
1123
|
+
def exchange_with(from, to_currency, &block); end
|
1124
|
+
|
1125
|
+
# Return the known rates as a string in the format specified. If +file+
|
1126
|
+
# is given will also write the string out to the file specified.
|
1127
|
+
# Available formats are +:json+, +:ruby+ and +:yaml+.
|
1128
|
+
#
|
1129
|
+
# @example
|
1130
|
+
# bank = Money::Bank::VariableExchange.new
|
1131
|
+
# bank.set_rate("USD", "CAD", 1.24515)
|
1132
|
+
# bank.set_rate("CAD", "USD", 0.803115)
|
1133
|
+
#
|
1134
|
+
# s = bank.export_rates(:json)
|
1135
|
+
# s #=> "{\"USD_TO_CAD\":1.24515,\"CAD_TO_USD\":0.803115}"
|
1136
|
+
# @param format [Symbol] Request format for the resulting string.
|
1137
|
+
# @param file [String] Optional file location to write the rates to.
|
1138
|
+
# @param opts [Hash] Options hash to set special parameters. Backwards compatibility only.
|
1139
|
+
# @raise +Money::Bank::UnknownRateFormat+ if format is unknown.
|
1140
|
+
# @return [String]
|
1141
|
+
#
|
1142
|
+
# source://money//lib/money/bank/variable_exchange.rb#221
|
1143
|
+
def export_rates(format, file = T.unsafe(nil), opts = T.unsafe(nil)); end
|
1144
|
+
|
1145
|
+
# Retrieve the rate for the given currencies.
|
1146
|
+
# data access.
|
1147
|
+
# Delegates to +Money::RatesStore::Memory+
|
1148
|
+
#
|
1149
|
+
# @example
|
1150
|
+
# bank = Money::Bank::VariableExchange.new
|
1151
|
+
# bank.set_rate("USD", "CAD", 1.24515)
|
1152
|
+
# bank.set_rate("CAD", "USD", 0.803115)
|
1153
|
+
#
|
1154
|
+
# bank.get_rate("USD", "CAD") #=> 1.24515
|
1155
|
+
# bank.get_rate("CAD", "USD") #=> 0.803115
|
1156
|
+
# @param from [Currency, String, Symbol] Currency to exchange from.
|
1157
|
+
# @param to [Currency, String, Symbol] Currency to exchange to.
|
1158
|
+
# @param opts [Hash] Options hash to set special parameters. Backwards compatibility only.
|
1159
|
+
# @return [Numeric]
|
1160
|
+
#
|
1161
|
+
# source://money//lib/money/bank/variable_exchange.rb#198
|
1162
|
+
def get_rate(from, to, opts = T.unsafe(nil)); end
|
1163
|
+
|
1164
|
+
# Loads rates provided in +s+ given the specified format. Available
|
1165
|
+
# formats are +:json+, +:ruby+ and +:yaml+.
|
1166
|
+
# Delegates to +Money::RatesStore::Memory+
|
1167
|
+
#
|
1168
|
+
# @example
|
1169
|
+
# s = "{\"USD_TO_CAD\":1.24515,\"CAD_TO_USD\":0.803115}"
|
1170
|
+
# bank = Money::Bank::VariableExchange.new
|
1171
|
+
# bank.import_rates(:json, s)
|
1172
|
+
#
|
1173
|
+
# bank.get_rate("USD", "CAD") #=> 1.24515
|
1174
|
+
# bank.get_rate("CAD", "USD") #=> 0.803115
|
1175
|
+
# @param format [Symbol] The format of +s+.
|
1176
|
+
# @param s [String] The rates string.
|
1177
|
+
# @param opts [Hash] Options hash to set special parameters. Backwards compatibility only.
|
1178
|
+
# @raise +Money::Bank::UnknownRateFormat+ if format is unknown.
|
1179
|
+
# @return [self]
|
1180
|
+
#
|
1181
|
+
# source://money//lib/money/bank/variable_exchange.rb#261
|
1182
|
+
def import_rates(format, s, opts = T.unsafe(nil)); end
|
1183
|
+
|
1184
|
+
# source://money//lib/money/bank/variable_exchange.rb#68
|
1185
|
+
def marshal_dump; end
|
1186
|
+
|
1187
|
+
# source://money//lib/money/bank/variable_exchange.rb#72
|
1188
|
+
def marshal_load(arr); end
|
1189
|
+
|
1190
|
+
# Returns the value of attribute mutex.
|
1191
|
+
#
|
1192
|
+
# source://money//lib/money/bank/variable_exchange.rb#45
|
1193
|
+
def mutex; end
|
1194
|
+
|
1195
|
+
# This should be deprecated.
|
1196
|
+
#
|
1197
|
+
# source://money//lib/money/bank/variable_exchange.rb#236
|
1198
|
+
def rates; end
|
1199
|
+
|
1200
|
+
# Set the rate for the given currencies.
|
1201
|
+
# access.
|
1202
|
+
# Delegates to +Money::RatesStore::Memory+
|
1203
|
+
#
|
1204
|
+
# @example
|
1205
|
+
# bank = Money::Bank::VariableExchange.new
|
1206
|
+
# bank.set_rate("USD", "CAD", 1.24515)
|
1207
|
+
# bank.set_rate("CAD", "USD", 0.803115)
|
1208
|
+
# @param from [Currency, String, Symbol] Currency to exchange from.
|
1209
|
+
# @param to [Currency, String, Symbol] Currency to exchange to.
|
1210
|
+
# @param rate [Numeric] Rate to use when exchanging currencies.
|
1211
|
+
# @param opts [Hash] Options hash to set special parameters. Backwards compatibility only.
|
1212
|
+
# @return [Numeric]
|
1213
|
+
#
|
1214
|
+
# source://money//lib/money/bank/variable_exchange.rb#177
|
1215
|
+
def set_rate(from, to, rate, opts = T.unsafe(nil)); end
|
1216
|
+
|
1217
|
+
# source://money//lib/money/bank/variable_exchange.rb#64
|
1218
|
+
def store; end
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
# source://money//lib/money/bank/variable_exchange.rb#50
|
1222
|
+
Money::Bank::VariableExchange::FORMAT_SERIALIZERS = T.let(T.unsafe(nil), Hash)
|
1223
|
+
|
1224
|
+
# Available formats for importing/exporting rates.
|
1225
|
+
#
|
1226
|
+
# source://money//lib/money/bank/variable_exchange.rb#48
|
1227
|
+
Money::Bank::VariableExchange::RATE_FORMATS = T.let(T.unsafe(nil), Array)
|
1228
|
+
|
1229
|
+
# source://money//lib/money/bank/variable_exchange.rb#49
|
1230
|
+
Money::Bank::VariableExchange::SERIALIZER_SEPARATOR = T.let(T.unsafe(nil), String)
|
1231
|
+
|
1232
|
+
# source://money//lib/money/money/constructors.rb#2
|
1233
|
+
module Money::Constructors
|
1234
|
+
# Creates a new Money object of the given value, using the Canadian
|
1235
|
+
# dollar currency.
|
1236
|
+
#
|
1237
|
+
# @example
|
1238
|
+
# n = Money.ca_dollar(100)
|
1239
|
+
# n.cents #=> 100
|
1240
|
+
# n.currency #=> #<Money::Currency id: cad>
|
1241
|
+
# @param cents [Integer] The cents value.
|
1242
|
+
# @return [Money]
|
1243
|
+
#
|
1244
|
+
# source://money//lib/money/money/constructors.rb#29
|
1245
|
+
def ca_dollar(cents); end
|
1246
|
+
|
1247
|
+
# Creates a new Money object of the given value, using the Canadian
|
1248
|
+
# dollar currency.
|
1249
|
+
#
|
1250
|
+
# @example
|
1251
|
+
# n = Money.ca_dollar(100)
|
1252
|
+
# n.cents #=> 100
|
1253
|
+
# n.currency #=> #<Money::Currency id: cad>
|
1254
|
+
# @param cents [Integer] The cents value.
|
1255
|
+
# @return [Money]
|
1256
|
+
#
|
1257
|
+
# source://money//lib/money/money/constructors.rb#29
|
1258
|
+
def cad(cents); end
|
1259
|
+
|
1260
|
+
# Create a new money object with value 0.
|
1261
|
+
#
|
1262
|
+
# @example
|
1263
|
+
# Money.empty #=> #<Money @fractional=0>
|
1264
|
+
# @param currency [Currency, String, Symbol] The currency to use.
|
1265
|
+
# @return [Money]
|
1266
|
+
#
|
1267
|
+
# source://money//lib/money/money/constructors.rb#12
|
1268
|
+
def empty(currency = T.unsafe(nil)); end
|
1269
|
+
|
1270
|
+
# Creates a new Money object of the given value, using the Euro currency.
|
1271
|
+
#
|
1272
|
+
# @example
|
1273
|
+
# n = Money.euro(100)
|
1274
|
+
# n.cents #=> 100
|
1275
|
+
# n.currency #=> #<Money::Currency id: eur>
|
1276
|
+
# @param cents [Integer] The cents value.
|
1277
|
+
# @return [Money]
|
1278
|
+
#
|
1279
|
+
# source://money//lib/money/money/constructors.rb#62
|
1280
|
+
def eur(cents); end
|
1281
|
+
|
1282
|
+
# Creates a new Money object of the given value, using the Euro currency.
|
1283
|
+
#
|
1284
|
+
# @example
|
1285
|
+
# n = Money.euro(100)
|
1286
|
+
# n.cents #=> 100
|
1287
|
+
# n.currency #=> #<Money::Currency id: eur>
|
1288
|
+
# @param cents [Integer] The cents value.
|
1289
|
+
# @return [Money]
|
1290
|
+
#
|
1291
|
+
# source://money//lib/money/money/constructors.rb#62
|
1292
|
+
def euro(cents); end
|
1293
|
+
|
1294
|
+
# Creates a new Money object of the given value, in British pounds.
|
1295
|
+
#
|
1296
|
+
# @example
|
1297
|
+
# n = Money.pound_sterling(100)
|
1298
|
+
# n.fractional #=> 100
|
1299
|
+
# n.currency #=> #<Money::Currency id: gbp>
|
1300
|
+
# @param pence [Integer] The pence value.
|
1301
|
+
# @return [Money]
|
1302
|
+
#
|
1303
|
+
# source://money//lib/money/money/constructors.rb#78
|
1304
|
+
def gbp(pence); end
|
1305
|
+
|
1306
|
+
# Creates a new Money object of the given value, in British pounds.
|
1307
|
+
#
|
1308
|
+
# @example
|
1309
|
+
# n = Money.pound_sterling(100)
|
1310
|
+
# n.fractional #=> 100
|
1311
|
+
# n.currency #=> #<Money::Currency id: gbp>
|
1312
|
+
# @param pence [Integer] The pence value.
|
1313
|
+
# @return [Money]
|
1314
|
+
#
|
1315
|
+
# source://money//lib/money/money/constructors.rb#78
|
1316
|
+
def pound_sterling(pence); end
|
1317
|
+
|
1318
|
+
# Creates a new Money object of the given value, using the American dollar
|
1319
|
+
# currency.
|
1320
|
+
#
|
1321
|
+
# @example
|
1322
|
+
# n = Money.us_dollar(100)
|
1323
|
+
# n.cents #=> 100
|
1324
|
+
# n.currency #=> #<Money::Currency id: usd>
|
1325
|
+
# @param cents [Integer] The cents value.
|
1326
|
+
# @return [Money]
|
1327
|
+
#
|
1328
|
+
# source://money//lib/money/money/constructors.rb#46
|
1329
|
+
def us_dollar(cents); end
|
1330
|
+
|
1331
|
+
# Creates a new Money object of the given value, using the American dollar
|
1332
|
+
# currency.
|
1333
|
+
#
|
1334
|
+
# @example
|
1335
|
+
# n = Money.us_dollar(100)
|
1336
|
+
# n.cents #=> 100
|
1337
|
+
# n.currency #=> #<Money::Currency id: usd>
|
1338
|
+
# @param cents [Integer] The cents value.
|
1339
|
+
# @return [Money]
|
1340
|
+
#
|
1341
|
+
# source://money//lib/money/money/constructors.rb#46
|
1342
|
+
def usd(cents); end
|
1343
|
+
|
1344
|
+
# Create a new money object with value 0.
|
1345
|
+
#
|
1346
|
+
# @example
|
1347
|
+
# Money.empty #=> #<Money @fractional=0>
|
1348
|
+
# @param currency [Currency, String, Symbol] The currency to use.
|
1349
|
+
# @return [Money]
|
1350
|
+
#
|
1351
|
+
# source://money//lib/money/money/constructors.rb#12
|
1352
|
+
def zero(currency = T.unsafe(nil)); end
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
# Represents a specific currency unit.
|
1356
|
+
#
|
1357
|
+
# @see https://en.wikipedia.org/wiki/Currency
|
1358
|
+
# @see http://iso4217.net/
|
1359
|
+
#
|
1360
|
+
# source://money//lib/money/currency/loader.rb#2
|
1361
|
+
class Money::Currency
|
1362
|
+
include ::Comparable
|
1363
|
+
extend ::Enumerable
|
1364
|
+
extend ::Money::Currency::Heuristics
|
1365
|
+
|
1366
|
+
# Create a new +Currency+ object.
|
1367
|
+
#
|
1368
|
+
# @example
|
1369
|
+
# Money::Currency.new(:usd) #=> #<Money::Currency id: usd ...>
|
1370
|
+
# @param id [String, Symbol, #to_s] Used to look into +table+ and retrieve
|
1371
|
+
# the applicable attributes.
|
1372
|
+
# @return [Money::Currency]
|
1373
|
+
#
|
1374
|
+
# source://money//lib/money/currency.rb#275
|
1375
|
+
def initialize(id); end
|
1376
|
+
|
1377
|
+
# Compares +self+ with +other_currency+ against the value of +priority+
|
1378
|
+
# attribute.
|
1379
|
+
#
|
1380
|
+
# @example
|
1381
|
+
# c1 = Money::Currency.new(:usd)
|
1382
|
+
# c2 = Money::Currency.new(:jpy)
|
1383
|
+
# c1 <=> c2 #=> 1
|
1384
|
+
# c2 <=> c1 #=> -1
|
1385
|
+
# c1 <=> c1 #=> 0
|
1386
|
+
# @param other_currency [Money::Currency] The currency to compare to.
|
1387
|
+
# @return [-1, 0, 1] -1 if less than, 0 is equal to, 1 if greater than
|
1388
|
+
#
|
1389
|
+
# source://money//lib/money/currency.rb#293
|
1390
|
+
def <=>(other_currency); end
|
1391
|
+
|
1392
|
+
# Compares +self+ with +other_currency+ and returns +true+ if the are the
|
1393
|
+
# same or if their +id+ attributes match.
|
1394
|
+
#
|
1395
|
+
# @example
|
1396
|
+
# c1 = Money::Currency.new(:usd)
|
1397
|
+
# c2 = Money::Currency.new(:jpy)
|
1398
|
+
# c1 == c1 #=> true
|
1399
|
+
# c1 == c2 #=> false
|
1400
|
+
# @param other_currency [Money::Currency] The currency to compare to.
|
1401
|
+
# @return [Boolean]
|
1402
|
+
#
|
1403
|
+
# source://money//lib/money/currency.rb#316
|
1404
|
+
def ==(other_currency); end
|
1405
|
+
|
1406
|
+
# Returns currency symbol or iso code for currencies with no symbol.
|
1407
|
+
#
|
1408
|
+
# @return [String]
|
1409
|
+
#
|
1410
|
+
# source://money//lib/money/currency.rb#400
|
1411
|
+
def code; end
|
1412
|
+
|
1413
|
+
# @return [String] The decimal mark, or character used to separate the
|
1414
|
+
# whole unit from the subunit.
|
1415
|
+
#
|
1416
|
+
# source://money//lib/money/currency.rb#258
|
1417
|
+
def decimal_mark; end
|
1418
|
+
|
1419
|
+
# Returns the relation between subunit and unit as a base 10 exponent.
|
1420
|
+
#
|
1421
|
+
# Note that MGA and MRU are exceptions and are rounded to 1
|
1422
|
+
#
|
1423
|
+
# @return [Integer]
|
1424
|
+
# @see https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
1425
|
+
#
|
1426
|
+
# source://money//lib/money/currency.rb#425
|
1427
|
+
def decimal_places; end
|
1428
|
+
|
1429
|
+
# @return [String] The character used to separate thousands grouping of
|
1430
|
+
# the whole unit.
|
1431
|
+
#
|
1432
|
+
# source://money//lib/money/currency.rb#258
|
1433
|
+
def delimiter; end
|
1434
|
+
|
1435
|
+
# @return [String] Alternative currency used if symbol is ambiguous
|
1436
|
+
#
|
1437
|
+
# source://money//lib/money/currency.rb#258
|
1438
|
+
def disambiguate_symbol; end
|
1439
|
+
|
1440
|
+
def eql?(_arg0); end
|
1441
|
+
|
1442
|
+
# Returns the relation between subunit and unit as a base 10 exponent.
|
1443
|
+
#
|
1444
|
+
# Note that MGA and MRU are exceptions and are rounded to 1
|
1445
|
+
#
|
1446
|
+
# @return [Integer]
|
1447
|
+
# @see https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
1448
|
+
#
|
1449
|
+
# source://money//lib/money/currency.rb#425
|
1450
|
+
def exponent; end
|
1451
|
+
|
1452
|
+
# Returns the value of attribute format.
|
1453
|
+
#
|
1454
|
+
# source://money//lib/money/currency.rb#258
|
1455
|
+
def format; end
|
1456
|
+
|
1457
|
+
# Returns a Integer hash value based on the +id+ attribute in order to use
|
1458
|
+
# functions like & (intersection), group_by, etc.
|
1459
|
+
#
|
1460
|
+
# @example
|
1461
|
+
# Money::Currency.new(:usd).hash #=> 428936
|
1462
|
+
# @return [Integer]
|
1463
|
+
#
|
1464
|
+
# source://money//lib/money/currency.rb#337
|
1465
|
+
def hash; end
|
1466
|
+
|
1467
|
+
# @return [String] The html entity for the currency symbol
|
1468
|
+
#
|
1469
|
+
# source://money//lib/money/currency.rb#258
|
1470
|
+
def html_entity; end
|
1471
|
+
|
1472
|
+
# @return [Symbol] The symbol used to identify the currency, usually THE
|
1473
|
+
# lowercase +iso_code+ attribute.
|
1474
|
+
#
|
1475
|
+
# source://money//lib/money/currency.rb#258
|
1476
|
+
def id; end
|
1477
|
+
|
1478
|
+
# Returns a human readable representation.
|
1479
|
+
#
|
1480
|
+
# @example
|
1481
|
+
# Money::Currency.new(:usd) #=> #<Currency id: usd ...>
|
1482
|
+
# @return [String]
|
1483
|
+
#
|
1484
|
+
# source://money//lib/money/currency.rb#347
|
1485
|
+
def inspect; end
|
1486
|
+
|
1487
|
+
# Returns if a code currency is ISO.
|
1488
|
+
#
|
1489
|
+
# @example
|
1490
|
+
# Money::Currency.new(:usd).iso?
|
1491
|
+
# @return [Boolean]
|
1492
|
+
#
|
1493
|
+
# source://money//lib/money/currency.rb#415
|
1494
|
+
def iso?; end
|
1495
|
+
|
1496
|
+
# @return [String] The international 3-letter code as defined by the ISO
|
1497
|
+
# 4217 standard.
|
1498
|
+
#
|
1499
|
+
# source://money//lib/money/currency.rb#258
|
1500
|
+
def iso_code; end
|
1501
|
+
|
1502
|
+
# @return [String] The international 3-numeric code as defined by the ISO
|
1503
|
+
# 4217 standard.
|
1504
|
+
#
|
1505
|
+
# source://money//lib/money/currency.rb#258
|
1506
|
+
def iso_numeric; end
|
1507
|
+
|
1508
|
+
# @return [String] The currency name.
|
1509
|
+
#
|
1510
|
+
# source://money//lib/money/currency.rb#258
|
1511
|
+
def name; end
|
1512
|
+
|
1513
|
+
# @return [Integer] A numerical value you can use to sort/group the
|
1514
|
+
# currency list.
|
1515
|
+
#
|
1516
|
+
# source://money//lib/money/currency.rb#258
|
1517
|
+
def priority; end
|
1518
|
+
|
1519
|
+
# @return [String] The decimal mark, or character used to separate the
|
1520
|
+
# whole unit from the subunit.
|
1521
|
+
#
|
1522
|
+
# source://money//lib/money/currency.rb#258
|
1523
|
+
def separator; end
|
1524
|
+
|
1525
|
+
# @return [Integer] Smallest amount of cash possible (in the subunit of
|
1526
|
+
# this currency)
|
1527
|
+
#
|
1528
|
+
# source://money//lib/money/currency.rb#258
|
1529
|
+
def smallest_denomination; end
|
1530
|
+
|
1531
|
+
# @return [String] The name of the fractional monetary unit.
|
1532
|
+
#
|
1533
|
+
# source://money//lib/money/currency.rb#258
|
1534
|
+
def subunit; end
|
1535
|
+
|
1536
|
+
# @return [Integer] The proportion between the unit and the subunit
|
1537
|
+
#
|
1538
|
+
# source://money//lib/money/currency.rb#258
|
1539
|
+
def subunit_to_unit; end
|
1540
|
+
|
1541
|
+
# @return [String] The currency symbol (UTF-8 encoded).
|
1542
|
+
#
|
1543
|
+
# source://money//lib/money/currency.rb#258
|
1544
|
+
def symbol; end
|
1545
|
+
|
1546
|
+
# @return [Boolean] Should the currency symbol precede the amount, or
|
1547
|
+
# should it come after?
|
1548
|
+
#
|
1549
|
+
# source://money//lib/money/currency.rb#258
|
1550
|
+
def symbol_first; end
|
1551
|
+
|
1552
|
+
# @return [Boolean]
|
1553
|
+
#
|
1554
|
+
# source://money//lib/money/currency.rb#404
|
1555
|
+
def symbol_first?; end
|
1556
|
+
|
1557
|
+
# @return [String] The character used to separate thousands grouping of
|
1558
|
+
# the whole unit.
|
1559
|
+
#
|
1560
|
+
# source://money//lib/money/currency.rb#258
|
1561
|
+
def thousands_separator; end
|
1562
|
+
|
1563
|
+
# Conversion to +self+.
|
1564
|
+
#
|
1565
|
+
# @return [self]
|
1566
|
+
#
|
1567
|
+
# source://money//lib/money/currency.rb#393
|
1568
|
+
def to_currency; end
|
1569
|
+
|
1570
|
+
# Returns a string representation corresponding to the upcase +id+
|
1571
|
+
# attribute.
|
1572
|
+
#
|
1573
|
+
# --
|
1574
|
+
# DEV: id.to_s.upcase corresponds to iso_code but don't use ISO_CODE for consistency.
|
1575
|
+
#
|
1576
|
+
# @example
|
1577
|
+
# Money::Currency.new(:usd).to_s #=> "USD"
|
1578
|
+
# Money::Currency.new(:eur).to_s #=> "EUR"
|
1579
|
+
# @return [String]
|
1580
|
+
#
|
1581
|
+
# source://money//lib/money/currency.rb#362
|
1582
|
+
def to_s; end
|
1583
|
+
|
1584
|
+
# Returns a string representation corresponding to the upcase +id+
|
1585
|
+
# attribute. Useful in cases where only implicit conversions are made.
|
1586
|
+
#
|
1587
|
+
# @example
|
1588
|
+
# Money::Currency.new(:usd).to_str #=> "USD"
|
1589
|
+
# Money::Currency.new(:eur).to_str #=> "EUR"
|
1590
|
+
# @return [String]
|
1591
|
+
#
|
1592
|
+
# source://money//lib/money/currency.rb#374
|
1593
|
+
def to_str; end
|
1594
|
+
|
1595
|
+
# Returns a symbol representation corresponding to the upcase +id+
|
1596
|
+
# attribute.
|
1597
|
+
#
|
1598
|
+
# @example
|
1599
|
+
# Money::Currency.new(:usd).to_sym #=> :USD
|
1600
|
+
# Money::Currency.new(:eur).to_sym #=> :EUR
|
1601
|
+
# @return [Symbol]
|
1602
|
+
#
|
1603
|
+
# source://money//lib/money/currency.rb#386
|
1604
|
+
def to_sym; end
|
1605
|
+
|
1606
|
+
private
|
1607
|
+
|
1608
|
+
# source://money//lib/money/currency.rb#320
|
1609
|
+
def compare_ids(other_currency); end
|
1610
|
+
|
1611
|
+
# source://money//lib/money/currency.rb#432
|
1612
|
+
def initialize_data!; end
|
1613
|
+
|
1614
|
+
class << self
|
1615
|
+
# source://money//lib/money/currency.rb#46
|
1616
|
+
def _instances; end
|
1617
|
+
|
1618
|
+
# List the currencies imported and registered
|
1619
|
+
#
|
1620
|
+
# @example
|
1621
|
+
# Money::Currency.all()
|
1622
|
+
# [#<Currency ..USD>, 'CAD', 'EUR']...
|
1623
|
+
# @return [Array]
|
1624
|
+
#
|
1625
|
+
# source://money//lib/money/currency.rb#133
|
1626
|
+
def all; end
|
1627
|
+
|
1628
|
+
# source://money//lib/money/currency.rb#205
|
1629
|
+
def each; end
|
1630
|
+
|
1631
|
+
# Lookup a currency with given +id+ an returns a +Currency+ instance on
|
1632
|
+
# success, +nil+ otherwise.
|
1633
|
+
#
|
1634
|
+
# retrieve the applicable attributes.
|
1635
|
+
#
|
1636
|
+
# @example
|
1637
|
+
# Money::Currency.find(:eur) #=> #<Money::Currency id: eur ...>
|
1638
|
+
# Money::Currency.find(:foo) #=> nil
|
1639
|
+
# @param id [String, Symbol, #to_s] Used to look into +table+ and
|
1640
|
+
# @return [Money::Currency]
|
1641
|
+
#
|
1642
|
+
# source://money//lib/money/currency.rb#61
|
1643
|
+
def find(id); end
|
1644
|
+
|
1645
|
+
# Lookup a currency with given +num+ as an ISO 4217 numeric and returns an
|
1646
|
+
# +Currency+ instance on success, +nil+ otherwise.
|
1647
|
+
#
|
1648
|
+
# the right currency id.
|
1649
|
+
#
|
1650
|
+
# @example
|
1651
|
+
# Money::Currency.find_by_iso_numeric(978) #=> #<Money::Currency id: eur ...>
|
1652
|
+
# Money::Currency.find_by_iso_numeric(51) #=> #<Money::Currency id: amd ...>
|
1653
|
+
# Money::Currency.find_by_iso_numeric('001') #=> nil
|
1654
|
+
# @param num [#to_s] used to look into +table+ in +iso_numeric+ and find
|
1655
|
+
# @return [Money::Currency]
|
1656
|
+
#
|
1657
|
+
# source://money//lib/money/currency.rb#80
|
1658
|
+
def find_by_iso_numeric(num); end
|
1659
|
+
|
1660
|
+
# Inherit a new currency from existing one
|
1661
|
+
#
|
1662
|
+
# @param parent_iso_code [String] the international 3-letter code as defined
|
1663
|
+
# @param curr [Hash] See {register} method for hash structure
|
1664
|
+
#
|
1665
|
+
# source://money//lib/money/currency.rb#181
|
1666
|
+
def inherit(parent_iso_code, curr); end
|
1667
|
+
|
1668
|
+
# source://money//lib/money/currency.rb#37
|
1669
|
+
def new(id); end
|
1670
|
+
|
1671
|
+
# Register a new currency
|
1672
|
+
#
|
1673
|
+
# @option priority
|
1674
|
+
# @option iso_code
|
1675
|
+
# @option iso_numeric
|
1676
|
+
# @option name
|
1677
|
+
# @option symbol
|
1678
|
+
# @option subunit
|
1679
|
+
# @option subunit_to_unit
|
1680
|
+
# @option separator
|
1681
|
+
# @option delimiter
|
1682
|
+
# @param curr [Hash] information about the currency
|
1683
|
+
# @param priority [Hash] a customizable set of options
|
1684
|
+
# @param iso_code [Hash] a customizable set of options
|
1685
|
+
# @param iso_numeric [Hash] a customizable set of options
|
1686
|
+
# @param name [Hash] a customizable set of options
|
1687
|
+
# @param symbol [Hash] a customizable set of options
|
1688
|
+
# @param subunit [Hash] a customizable set of options
|
1689
|
+
# @param subunit_to_unit [Hash] a customizable set of options
|
1690
|
+
# @param separator [Hash] a customizable set of options
|
1691
|
+
# @param delimiter [Hash] a customizable set of options
|
1692
|
+
#
|
1693
|
+
# source://money//lib/money/currency.rb#170
|
1694
|
+
def register(curr); end
|
1695
|
+
|
1696
|
+
# source://money//lib/money/currency.rb#209
|
1697
|
+
def reset!; end
|
1698
|
+
|
1699
|
+
# We need a string-based validator before creating an unbounded number of
|
1700
|
+
# symbols.
|
1701
|
+
# http://www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol#11
|
1702
|
+
# https://github.com/RubyMoney/money/issues/132
|
1703
|
+
#
|
1704
|
+
# @return [Set]
|
1705
|
+
#
|
1706
|
+
# source://money//lib/money/currency.rb#149
|
1707
|
+
def stringified_keys; end
|
1708
|
+
|
1709
|
+
# List of known currencies.
|
1710
|
+
#
|
1711
|
+
# == monetary unit
|
1712
|
+
# The standard unit of value of a currency, as the dollar in the United States or the peso in Mexico.
|
1713
|
+
# https://www.answers.com/topic/monetary-unit
|
1714
|
+
# == fractional monetary unit, subunit
|
1715
|
+
# A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit
|
1716
|
+
# https://www.answers.com/topic/fractional-monetary-unit-subunit
|
1717
|
+
#
|
1718
|
+
# See https://en.wikipedia.org/wiki/List_of_circulating_currencies and
|
1719
|
+
# http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
|
1720
|
+
#
|
1721
|
+
# source://money//lib/money/currency.rb#123
|
1722
|
+
def table; end
|
1723
|
+
|
1724
|
+
# Unregister a currency.
|
1725
|
+
#
|
1726
|
+
# @param curr [Object] A Hash with the key `:iso_code`, or the ISO code
|
1727
|
+
# as a String or Symbol.
|
1728
|
+
# @return [Boolean] true if the currency previously existed, false
|
1729
|
+
# if it didn't.
|
1730
|
+
#
|
1731
|
+
# source://money//lib/money/currency.rb#194
|
1732
|
+
def unregister(curr); end
|
1733
|
+
|
1734
|
+
# Wraps the object in a +Currency+ unless it's already a +Currency+
|
1735
|
+
# object.
|
1736
|
+
#
|
1737
|
+
# object.
|
1738
|
+
#
|
1739
|
+
# @example
|
1740
|
+
# c1 = Money::Currency.new(:usd)
|
1741
|
+
# Money::Currency.wrap(nil) #=> nil
|
1742
|
+
# Money::Currency.wrap(c1) #=> #<Money::Currency id: usd ...>
|
1743
|
+
# Money::Currency.wrap("usd") #=> #<Money::Currency id: usd ...>
|
1744
|
+
# @param object [Object] The object to attempt and wrap as a +Currency+
|
1745
|
+
# @return [Money::Currency]
|
1746
|
+
#
|
1747
|
+
# source://money//lib/money/currency.rb#102
|
1748
|
+
def wrap(object); end
|
1749
|
+
|
1750
|
+
private
|
1751
|
+
|
1752
|
+
# source://money//lib/money/currency.rb#216
|
1753
|
+
def stringify_keys; end
|
1754
|
+
end
|
1755
|
+
end
|
1756
|
+
|
1757
|
+
# source://money//lib/money/currency/heuristics.rb#5
|
1758
|
+
module Money::Currency::Heuristics
|
1759
|
+
# @raise [StandardError]
|
1760
|
+
#
|
1761
|
+
# source://money//lib/money/currency/heuristics.rb#6
|
1762
|
+
def analyze(str); end
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
# source://money//lib/money/currency/loader.rb#3
|
1766
|
+
module Money::Currency::Loader
|
1767
|
+
class << self
|
1768
|
+
# Loads and returns the currencies stored in JSON files in the config directory.
|
1769
|
+
#
|
1770
|
+
# @return [Hash]
|
1771
|
+
#
|
1772
|
+
# source://money//lib/money/currency/loader.rb#10
|
1773
|
+
def load_currencies; end
|
1774
|
+
|
1775
|
+
private
|
1776
|
+
|
1777
|
+
# source://money//lib/money/currency/loader.rb#18
|
1778
|
+
def parse_currency_file(filename); end
|
1779
|
+
end
|
1780
|
+
end
|
1781
|
+
|
1782
|
+
# source://money//lib/money/currency/loader.rb#4
|
1783
|
+
Money::Currency::Loader::DATA_PATH = T.let(T.unsafe(nil), String)
|
1784
|
+
|
1785
|
+
# Thrown when a Currency has been registered without all the attributes
|
1786
|
+
# which are required for the current action.
|
1787
|
+
#
|
1788
|
+
# source://money//lib/money/currency.rb#24
|
1789
|
+
class Money::Currency::MissingAttributeError < ::StandardError
|
1790
|
+
# @return [MissingAttributeError] a new instance of MissingAttributeError
|
1791
|
+
#
|
1792
|
+
# source://money//lib/money/currency.rb#25
|
1793
|
+
def initialize(method, currency, attribute); end
|
1794
|
+
end
|
1795
|
+
|
1796
|
+
# Thrown when an unknown currency is requested.
|
1797
|
+
#
|
1798
|
+
# source://money//lib/money/currency.rb#34
|
1799
|
+
class Money::Currency::UnknownCurrency < ::ArgumentError; end
|
1800
|
+
|
1801
|
+
# source://money//lib/money/money/formatter.rb#5
|
1802
|
+
class Money::Formatter
|
1803
|
+
# Creates a formatted price string according to several rules.
|
1804
|
+
#
|
1805
|
+
# with the symbol (if present) and `%n` will be replaced with the number.
|
1806
|
+
#
|
1807
|
+
# Note that the default rules can be defined through {Money.default_formatting_rules} hash.
|
1808
|
+
#
|
1809
|
+
# @example
|
1810
|
+
# Money.us_dollar(0).format(display_free: true) #=> "free"
|
1811
|
+
# Money.us_dollar(0).format(display_free: "gratis") #=> "gratis"
|
1812
|
+
# Money.us_dollar(0).format #=> "$0.00"
|
1813
|
+
# @example
|
1814
|
+
# Money.ca_dollar(100).format #=> "$1.00"
|
1815
|
+
# Money.ca_dollar(100).format(with_currency: true) #=> "$1.00 CAD"
|
1816
|
+
# Money.us_dollar(85).format(with_currency: true) #=> "$0.85 USD"
|
1817
|
+
# @example
|
1818
|
+
# Money.us_dollar(100.1).format #=> "$1.001"
|
1819
|
+
# Money.us_dollar(100.1).format(rounded_infinite_precision: true) #=> "$1"
|
1820
|
+
# Money.us_dollar(100.9).format(rounded_infinite_precision: true) #=> "$1.01"
|
1821
|
+
# @example
|
1822
|
+
# Money.ca_dollar(100).format(no_cents: true) #=> "$1"
|
1823
|
+
# Money.ca_dollar(599).format(no_cents: true) #=> "$5"
|
1824
|
+
# @example
|
1825
|
+
# Money.ca_dollar(10000).format(no_cents_if_whole: true) #=> "$100"
|
1826
|
+
# Money.ca_dollar(10034).format(no_cents_if_whole: true) #=> "$100.34"
|
1827
|
+
# @example
|
1828
|
+
# Money.new(100, "USD") #=> "$1.00"
|
1829
|
+
# Money.new(100, "GBP") #=> "£1.00"
|
1830
|
+
# Money.new(100, "EUR") #=> "€1.00"
|
1831
|
+
#
|
1832
|
+
# # Same thing.
|
1833
|
+
# Money.new(100, "USD").format(symbol: true) #=> "$1.00"
|
1834
|
+
# Money.new(100, "GBP").format(symbol: true) #=> "£1.00"
|
1835
|
+
# Money.new(100, "EUR").format(symbol: true) #=> "€1.00"
|
1836
|
+
#
|
1837
|
+
# # You can specify a false expression or an empty string to disable
|
1838
|
+
# # prepending a money symbol.§
|
1839
|
+
# Money.new(100, "USD").format(symbol: false) #=> "1.00"
|
1840
|
+
# Money.new(100, "GBP").format(symbol: nil) #=> "1.00"
|
1841
|
+
# Money.new(100, "EUR").format(symbol: "") #=> "1.00"
|
1842
|
+
#
|
1843
|
+
# # If the symbol for the given currency isn't known, then it will default
|
1844
|
+
# # to "¤" as symbol.
|
1845
|
+
# Money.new(100, "AWG").format(symbol: true) #=> "¤1.00"
|
1846
|
+
#
|
1847
|
+
# # You can specify a string as value to enforce using a particular symbol.
|
1848
|
+
# Money.new(100, "AWG").format(symbol: "ƒ") #=> "ƒ1.00"
|
1849
|
+
#
|
1850
|
+
# # You can specify a indian currency format
|
1851
|
+
# Money.new(10000000, "INR").format(south_asian_number_formatting: true) #=> "1,00,000.00"
|
1852
|
+
# Money.new(10000000).format(south_asian_number_formatting: true) #=> "$1,00,000.00"
|
1853
|
+
# @example
|
1854
|
+
# # Default is to not insert a space.
|
1855
|
+
# Money.new(100, "USD").format #=> "$1.00"
|
1856
|
+
#
|
1857
|
+
# # Same thing.
|
1858
|
+
# Money.new(100, "USD").format(symbol_before_without_space: true) #=> "$1.00"
|
1859
|
+
#
|
1860
|
+
# # If set to false, will insert a space.
|
1861
|
+
# Money.new(100, "USD").format(symbol_before_without_space: false) #=> "$ 1.00"
|
1862
|
+
# @example
|
1863
|
+
# # Default is to insert a space.
|
1864
|
+
# Money.new(100, "USD").format(symbol_position: :after) #=> "1.00 $"
|
1865
|
+
#
|
1866
|
+
# # If set to true, will not insert a space.
|
1867
|
+
# Money.new(100, "USD").format(symbol_position: :after, symbol_after_without_space: true) #=> "1.00$"
|
1868
|
+
# @example
|
1869
|
+
# # If a string is specified, it's value is used.
|
1870
|
+
# Money.new(100, "USD").format(decimal_mark: ",") #=> "$1,00"
|
1871
|
+
#
|
1872
|
+
# # If the decimal_mark for a given currency isn't known, then it will default
|
1873
|
+
# # to "." as decimal_mark.
|
1874
|
+
# Money.new(100, "FOO").format #=> "$1.00"
|
1875
|
+
# @example
|
1876
|
+
# # If a falsey value is specified, no thousands_separator is used.
|
1877
|
+
# Money.new(100000, "USD").format(thousands_separator: false) #=> "1000.00"
|
1878
|
+
# Money.new(100000, "USD").format(thousands_separator: nil) #=> "1000.00"
|
1879
|
+
# Money.new(100000, "USD").format(thousands_separator: "") #=> "1000.00"
|
1880
|
+
#
|
1881
|
+
# # If true is specified, the locale or default thousands_separator is used.
|
1882
|
+
# Money.new(100000, "USD").format(thousands_separator: true) #=> "1,000.00"
|
1883
|
+
#
|
1884
|
+
# # If a string is specified, it's value is used.
|
1885
|
+
# Money.new(100000, "USD").format(thousands_separator: ".") #=> "$1.000.00"
|
1886
|
+
#
|
1887
|
+
# # If the thousands_separator for a given currency isn't known, then it will
|
1888
|
+
# # default to "," as thousands_separator.
|
1889
|
+
# Money.new(100000, "FOO").format #=> "$1,000.00"
|
1890
|
+
# @example
|
1891
|
+
# Money.ca_dollar(570).format(html: true, with_currency: true)
|
1892
|
+
# #=> "$5.70 <span class=\"currency\">CAD</span>"
|
1893
|
+
# @example
|
1894
|
+
# Money.ca_dollar(570).format(html_wrap: true, with_currency: true)
|
1895
|
+
# #=> "<span class=\"money-currency-symbol\">$</span><span class=\"money-whole\">5</span><span class=\"money-decimal-mark\">.</span><span class=\"money-decimal\">70</span> <span class=\"money-currency\">CAD</span>"
|
1896
|
+
# @example
|
1897
|
+
# # You can specify to display the sign before the symbol for negative numbers
|
1898
|
+
# Money.new(-100, "GBP").format(sign_before_symbol: true) #=> "-£1.00"
|
1899
|
+
# Money.new(-100, "GBP").format(sign_before_symbol: false) #=> "£-1.00"
|
1900
|
+
# Money.new(-100, "GBP").format #=> "£-1.00"
|
1901
|
+
# @example
|
1902
|
+
# # You can specify to display the sign with positive numbers
|
1903
|
+
# Money.new(100, "GBP").format(sign_positive: true, sign_before_symbol: true) #=> "+£1.00"
|
1904
|
+
# Money.new(100, "GBP").format(sign_positive: true, sign_before_symbol: false) #=> "£+1.00"
|
1905
|
+
# Money.new(100, "GBP").format(sign_positive: false, sign_before_symbol: true) #=> "£1.00"
|
1906
|
+
# Money.new(100, "GBP").format(sign_positive: false, sign_before_symbol: false) #=> "£1.00"
|
1907
|
+
# Money.new(100, "GBP").format #=> "£+1.00"
|
1908
|
+
# @example
|
1909
|
+
# Money.new(10000, "USD").format(disambiguate: false) #=> "$100.00"
|
1910
|
+
# Money.new(10000, "CAD").format(disambiguate: false) #=> "$100.00"
|
1911
|
+
# Money.new(10000, "USD").format(disambiguate: true) #=> "$100.00"
|
1912
|
+
# Money.new(10000, "CAD").format(disambiguate: true) #=> "C$100.00"
|
1913
|
+
# @example
|
1914
|
+
# Money.new(10000, "USD").format(disambiguate: false)
|
1915
|
+
# #=> "<span class=\"currency_symbol\">$100.00</span>
|
1916
|
+
# @example
|
1917
|
+
# Money.new(10000, "USD").format(symbol_position: :before) #=> "$100.00"
|
1918
|
+
# Money.new(10000, "USD").format(symbol_position: :after) #=> "100.00 $"
|
1919
|
+
# @example
|
1920
|
+
# # With the following entry in the translation files:
|
1921
|
+
# # en:
|
1922
|
+
# # number:
|
1923
|
+
# # currency:
|
1924
|
+
# # symbol:
|
1925
|
+
# # CAD: "CAD$"
|
1926
|
+
# Money.new(10000, "CAD").format(translate: true) #=> "CAD$100.00"
|
1927
|
+
# @example
|
1928
|
+
# Money.new(89000, :btc).format(drop_trailing_zeros: true) #=> B⃦0.00089
|
1929
|
+
# Money.new(110, :usd).format(drop_trailing_zeros: true) #=> $1.1
|
1930
|
+
# @example
|
1931
|
+
# Money.new(89000, :btc).format(delimiter_pattern: /(\d)(?=\d)/) #=> B⃦8,9,0.00
|
1932
|
+
# @example
|
1933
|
+
# Money.new(10000, "USD").format(format: '%u %n') #=> "$ 100.00"
|
1934
|
+
# Money.new(10000, "USD").format(format: '<span>%u%n</span>') #=> "<span>$100.00</span>"
|
1935
|
+
# @option rules
|
1936
|
+
# @option rules
|
1937
|
+
# @option rules
|
1938
|
+
# @option rules
|
1939
|
+
# @option rules
|
1940
|
+
# @option rules
|
1941
|
+
# @option rules
|
1942
|
+
# @option rules
|
1943
|
+
# @option rules
|
1944
|
+
# @option rules
|
1945
|
+
# @option rules
|
1946
|
+
# @option rules
|
1947
|
+
# @option rules
|
1948
|
+
# @option rules
|
1949
|
+
# @option rules
|
1950
|
+
# @option rules
|
1951
|
+
# @option rules
|
1952
|
+
# @option rules
|
1953
|
+
# @option rules
|
1954
|
+
# @option rules
|
1955
|
+
# @option rules
|
1956
|
+
# @param rules [Hash] The options used to format the string.
|
1957
|
+
# @return [String]
|
1958
|
+
# @see Money.default_formatting_rules Money.default_formatting_rules for more information.
|
1959
|
+
#
|
1960
|
+
# source://money//lib/money/money/formatter.rb#233
|
1961
|
+
def initialize(money, *rules); end
|
1962
|
+
|
1963
|
+
# source://money//lib/money/money/formatter.rb#254
|
1964
|
+
def decimal_mark; end
|
1965
|
+
|
1966
|
+
# source://money//lib/money/money/formatter.rb#246
|
1967
|
+
def delimiter; end
|
1968
|
+
|
1969
|
+
# source://money//lib/money/money/formatter.rb#254
|
1970
|
+
def separator; end
|
1971
|
+
|
1972
|
+
# source://money//lib/money/money/formatter.rb#246
|
1973
|
+
def thousands_separator; end
|
1974
|
+
|
1975
|
+
# source://money//lib/money/money/formatter.rb#239
|
1976
|
+
def to_s; end
|
1977
|
+
|
1978
|
+
private
|
1979
|
+
|
1980
|
+
# source://money//lib/money/money/formatter.rb#317
|
1981
|
+
def append_currency_symbol(formatted_number); end
|
1982
|
+
|
1983
|
+
# source://money//lib/money/money/formatter.rb#288
|
1984
|
+
def append_sign(formatted_number); end
|
1985
|
+
|
1986
|
+
# Returns the value of attribute currency.
|
1987
|
+
#
|
1988
|
+
# source://money//lib/money/money/formatter.rb#263
|
1989
|
+
def currency; end
|
1990
|
+
|
1991
|
+
# source://money//lib/money/money/formatter.rb#351
|
1992
|
+
def extract_whole_and_decimal_parts; end
|
1993
|
+
|
1994
|
+
# source://money//lib/money/money/formatter.rb#364
|
1995
|
+
def format_decimal_part(value); end
|
1996
|
+
|
1997
|
+
# source://money//lib/money/money/formatter.rb#265
|
1998
|
+
def format_number; end
|
1999
|
+
|
2000
|
+
# source://money//lib/money/money/formatter.rb#344
|
2001
|
+
def format_whole_part(value); end
|
2002
|
+
|
2003
|
+
# source://money//lib/money/money/formatter.rb#340
|
2004
|
+
def free_text; end
|
2005
|
+
|
2006
|
+
# source://money//lib/money/money/formatter.rb#336
|
2007
|
+
def html_wrap(string, class_name); end
|
2008
|
+
|
2009
|
+
# source://money//lib/money/money/formatter.rb#378
|
2010
|
+
def lookup(key); end
|
2011
|
+
|
2012
|
+
# source://money//lib/money/money/formatter.rb#384
|
2013
|
+
def lookup_default(key); end
|
2014
|
+
|
2015
|
+
# Returns the value of attribute money.
|
2016
|
+
#
|
2017
|
+
# source://money//lib/money/money/formatter.rb#263
|
2018
|
+
def money; end
|
2019
|
+
|
2020
|
+
# Returns the value of attribute rules.
|
2021
|
+
#
|
2022
|
+
# source://money//lib/money/money/formatter.rb#263
|
2023
|
+
def rules; end
|
2024
|
+
|
2025
|
+
# @return [Boolean]
|
2026
|
+
#
|
2027
|
+
# source://money//lib/money/money/formatter.rb#332
|
2028
|
+
def show_free_text?; end
|
2029
|
+
|
2030
|
+
# source://money//lib/money/money/formatter.rb#388
|
2031
|
+
def symbol_value_from(rules); end
|
2032
|
+
end
|
2033
|
+
|
2034
|
+
# source://money//lib/money/money/formatter.rb#6
|
2035
|
+
Money::Formatter::DEFAULTS = T.let(T.unsafe(nil), Hash)
|
2036
|
+
|
2037
|
+
# source://money//lib/money/money/formatting_rules.rb#4
|
2038
|
+
class Money::FormattingRules
|
2039
|
+
# @return [FormattingRules] a new instance of FormattingRules
|
2040
|
+
#
|
2041
|
+
# source://money//lib/money/money/formatting_rules.rb#5
|
2042
|
+
def initialize(currency, *raw_rules); end
|
2043
|
+
|
2044
|
+
# source://money//lib/money/money/formatting_rules.rb#20
|
2045
|
+
def [](key); end
|
2046
|
+
|
2047
|
+
# @return [Boolean]
|
2048
|
+
#
|
2049
|
+
# source://money//lib/money/money/formatting_rules.rb#24
|
2050
|
+
def has_key?(key); end
|
2051
|
+
|
2052
|
+
private
|
2053
|
+
|
2054
|
+
# Returns the value of attribute currency.
|
2055
|
+
#
|
2056
|
+
# source://money//lib/money/money/formatting_rules.rb#30
|
2057
|
+
def currency; end
|
2058
|
+
|
2059
|
+
# source://money//lib/money/money/formatting_rules.rb#61
|
2060
|
+
def default_formatting_rules; end
|
2061
|
+
|
2062
|
+
# source://money//lib/money/money/formatting_rules.rb#94
|
2063
|
+
def delimiter_pattern_rule(rules); end
|
2064
|
+
|
2065
|
+
# source://money//lib/money/money/formatting_rules.rb#82
|
2066
|
+
def determine_format_from_formatting_rules(rules); end
|
2067
|
+
|
2068
|
+
# source://money//lib/money/money/formatting_rules.rb#74
|
2069
|
+
def localize_formatting_rules(rules); end
|
2070
|
+
|
2071
|
+
# Cleans up formatting rules.
|
2072
|
+
#
|
2073
|
+
# @param rules [Hash]
|
2074
|
+
# @return [Hash]
|
2075
|
+
#
|
2076
|
+
# source://money//lib/money/money/formatting_rules.rb#37
|
2077
|
+
def normalize_formatting_rules(rules); end
|
2078
|
+
|
2079
|
+
# source://money//lib/money/money/formatting_rules.rb#103
|
2080
|
+
def symbol_position_from(rules); end
|
2081
|
+
|
2082
|
+
# source://money//lib/money/money/formatting_rules.rb#65
|
2083
|
+
def translate_formatting_rules(rules); end
|
2084
|
+
|
2085
|
+
# source://money//lib/money/money/formatting_rules.rb#117
|
2086
|
+
def warn_about_deprecated_rules(rules); end
|
2087
|
+
end
|
2088
|
+
|
2089
|
+
# source://money//lib/money/locale_backend/errors.rb#2
|
2090
|
+
module Money::LocaleBackend
|
2091
|
+
class << self
|
2092
|
+
# @raise [Unknown]
|
2093
|
+
#
|
2094
|
+
# source://money//lib/money/money/locale_backend.rb#16
|
2095
|
+
def find(name); end
|
2096
|
+
end
|
2097
|
+
end
|
2098
|
+
|
2099
|
+
# source://money//lib/money/money/locale_backend.rb#10
|
2100
|
+
Money::LocaleBackend::BACKENDS = T.let(T.unsafe(nil), Hash)
|
2101
|
+
|
2102
|
+
# source://money//lib/money/locale_backend/base.rb#5
|
2103
|
+
class Money::LocaleBackend::Base; end
|
2104
|
+
|
2105
|
+
# source://money//lib/money/locale_backend/currency.rb#5
|
2106
|
+
class Money::LocaleBackend::Currency < ::Money::LocaleBackend::Base
|
2107
|
+
# source://money//lib/money/locale_backend/currency.rb#6
|
2108
|
+
def lookup(key, currency); end
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
# source://money//lib/money/locale_backend/i18n.rb#5
|
2112
|
+
class Money::LocaleBackend::I18n < ::Money::LocaleBackend::Base
|
2113
|
+
# @raise [NotSupported]
|
2114
|
+
# @return [I18n] a new instance of I18n
|
2115
|
+
#
|
2116
|
+
# source://money//lib/money/locale_backend/i18n.rb#12
|
2117
|
+
def initialize; end
|
2118
|
+
|
2119
|
+
# source://money//lib/money/locale_backend/i18n.rb#16
|
2120
|
+
def lookup(key, _); end
|
2121
|
+
end
|
2122
|
+
|
2123
|
+
# source://money//lib/money/locale_backend/i18n.rb#6
|
2124
|
+
Money::LocaleBackend::I18n::KEY_MAP = T.let(T.unsafe(nil), Hash)
|
2125
|
+
|
2126
|
+
# source://money//lib/money/locale_backend/legacy.rb#6
|
2127
|
+
class Money::LocaleBackend::Legacy < ::Money::LocaleBackend::Base
|
2128
|
+
# @raise [NotSupported]
|
2129
|
+
# @return [Legacy] a new instance of Legacy
|
2130
|
+
#
|
2131
|
+
# source://money//lib/money/locale_backend/legacy.rb#7
|
2132
|
+
def initialize; end
|
2133
|
+
|
2134
|
+
# source://money//lib/money/locale_backend/legacy.rb#11
|
2135
|
+
def lookup(key, currency); end
|
2136
|
+
|
2137
|
+
private
|
2138
|
+
|
2139
|
+
# source://money//lib/money/locale_backend/legacy.rb#23
|
2140
|
+
def i18n_backend; end
|
2141
|
+
end
|
2142
|
+
|
2143
|
+
# source://money//lib/money/locale_backend/errors.rb#3
|
2144
|
+
class Money::LocaleBackend::NotSupported < ::StandardError; end
|
2145
|
+
|
2146
|
+
# source://money//lib/money/locale_backend/errors.rb#4
|
2147
|
+
class Money::LocaleBackend::Unknown < ::ArgumentError; end
|
2148
|
+
|
2149
|
+
# source://money//lib/money/rates_store/memory.rb#4
|
2150
|
+
module Money::RatesStore; end
|
2151
|
+
|
2152
|
+
# Class for thread-safe storage of exchange rate pairs.
|
2153
|
+
# Used by instances of +Money::Bank::VariableExchange+.
|
2154
|
+
#
|
2155
|
+
# @example
|
2156
|
+
# store = Money::RatesStore::Memory.new
|
2157
|
+
# store.add_rate 'USD', 'CAD', 0.98
|
2158
|
+
# store.get_rate 'USD', 'CAD' # => 0.98
|
2159
|
+
# # iterates rates
|
2160
|
+
# store.each_rate {|iso_from, iso_to, rate| puts "#{from} -> #{to}: #{rate}" }
|
2161
|
+
#
|
2162
|
+
# source://money//lib/money/rates_store/memory.rb#15
|
2163
|
+
class Money::RatesStore::Memory
|
2164
|
+
# Initializes a new +Money::RatesStore::Memory+ object.
|
2165
|
+
#
|
2166
|
+
# @option opts
|
2167
|
+
# @param opts [Hash] Optional store options.
|
2168
|
+
# @param rates [Hash] Optional initial exchange rate data.
|
2169
|
+
# @return [Memory] a new instance of Memory
|
2170
|
+
#
|
2171
|
+
# source://money//lib/money/rates_store/memory.rb#23
|
2172
|
+
def initialize(opts = T.unsafe(nil), rates = T.unsafe(nil)); end
|
2173
|
+
|
2174
|
+
# Registers a conversion rate and returns it. Uses +Mutex+ to synchronize data access.
|
2175
|
+
#
|
2176
|
+
# @example
|
2177
|
+
# store = Money::RatesStore::Memory.new
|
2178
|
+
# store.add_rate("USD", "CAD", 1.24515)
|
2179
|
+
# store.add_rate("CAD", "USD", 0.803115)
|
2180
|
+
# @param currency_iso_from [String] Currency to exchange from.
|
2181
|
+
# @param currency_iso_to [String] Currency to exchange to.
|
2182
|
+
# @param rate [Numeric] Rate to use when exchanging currencies.
|
2183
|
+
# @return [Numeric]
|
2184
|
+
#
|
2185
|
+
# source://money//lib/money/rates_store/memory.rb#41
|
2186
|
+
def add_rate(currency_iso_from, currency_iso_to, rate); end
|
2187
|
+
|
2188
|
+
# Iterate over rate tuples (iso_from, iso_to, rate)
|
2189
|
+
#
|
2190
|
+
# @example
|
2191
|
+
# store.each_rate do |iso_from, iso_to, rate|
|
2192
|
+
# puts [iso_from, iso_to, rate].join
|
2193
|
+
# end
|
2194
|
+
# @return [Enumerator]
|
2195
|
+
# @yieldparam iso_from [String] Currency ISO string.
|
2196
|
+
# @yieldparam iso_to [String] Currency ISO string.
|
2197
|
+
# @yieldparam rate [Numeric] Exchange rate.
|
2198
|
+
#
|
2199
|
+
# source://money//lib/money/rates_store/memory.rb#91
|
2200
|
+
def each_rate(&block); end
|
2201
|
+
|
2202
|
+
# Retrieve the rate for the given currencies. Uses +Mutex+ to synchronize data access.
|
2203
|
+
# Delegates to +Money::RatesStore::Memory+
|
2204
|
+
#
|
2205
|
+
# @example
|
2206
|
+
# store = Money::RatesStore::Memory.new
|
2207
|
+
# store.add_rate("USD", "CAD", 1.24515)
|
2208
|
+
#
|
2209
|
+
# store.get_rate("USD", "CAD") #=> 1.24515
|
2210
|
+
# @param currency_iso_from [String] Currency to exchange from.
|
2211
|
+
# @param currency_iso_to [String] Currency to exchange to.
|
2212
|
+
# @return [Numeric]
|
2213
|
+
#
|
2214
|
+
# source://money//lib/money/rates_store/memory.rb#60
|
2215
|
+
def get_rate(currency_iso_from, currency_iso_to); end
|
2216
|
+
|
2217
|
+
# source://money//lib/money/rates_store/memory.rb#66
|
2218
|
+
def marshal_dump; end
|
2219
|
+
|
2220
|
+
# Wraps block execution in a thread-safe transaction
|
2221
|
+
#
|
2222
|
+
# source://money//lib/money/rates_store/memory.rb#73
|
2223
|
+
def transaction(&block); end
|
2224
|
+
|
2225
|
+
private
|
2226
|
+
|
2227
|
+
# Returns the value of attribute guard.
|
2228
|
+
#
|
2229
|
+
# source://money//lib/money/rates_store/memory.rb#104
|
2230
|
+
def guard; end
|
2231
|
+
|
2232
|
+
# Returns the value of attribute options.
|
2233
|
+
#
|
2234
|
+
# source://money//lib/money/rates_store/memory.rb#104
|
2235
|
+
def options; end
|
2236
|
+
|
2237
|
+
# Return the rate hashkey for the given currencies.
|
2238
|
+
#
|
2239
|
+
# @example
|
2240
|
+
# rate_key_for("USD", "CAD") #=> "USD_TO_CAD"
|
2241
|
+
# @param currency_iso_from [String] The currency to exchange from.
|
2242
|
+
# @param currency_iso_to [String] The currency to exchange to.
|
2243
|
+
# @return [String]
|
2244
|
+
#
|
2245
|
+
# source://money//lib/money/rates_store/memory.rb#115
|
2246
|
+
def rate_key_for(currency_iso_from, currency_iso_to); end
|
2247
|
+
|
2248
|
+
# Returns the value of attribute rates.
|
2249
|
+
#
|
2250
|
+
# source://money//lib/money/rates_store/memory.rb#104
|
2251
|
+
def rates; end
|
2252
|
+
end
|
2253
|
+
|
2254
|
+
# source://money//lib/money/rates_store/memory.rb#16
|
2255
|
+
Money::RatesStore::Memory::INDEX_KEY_SEPARATOR = T.let(T.unsafe(nil), String)
|
2256
|
+
|
2257
|
+
# Raised when smallest denomination of a currency is not defined
|
2258
|
+
#
|
2259
|
+
# source://money//lib/money/money.rb#25
|
2260
|
+
class Money::UndefinedSmallestDenomination < ::StandardError; end
|