Skip to content

Commit 76d9f5c

Browse files
committed
Lint: Fix Naming/BlockForwarding & Style/ArgumentsForwarding
See also #1134
1 parent 5e12076 commit 76d9f5c

File tree

6 files changed

+11
-33
lines changed

6 files changed

+11
-33
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/money/bank/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def setup
102102
# @yieldreturn [Integer]
103103
#
104104
# @return [Money]
105-
def exchange_with(from, to_currency, &block)
105+
def exchange_with(from, to_currency, &)
106106
raise NotImplementedError, "#exchange_with must be implemented"
107107
end
108108

lib/money/bank/single_currency.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SingleCurrency < Base
1818

1919
# Raises a DifferentCurrencyError to remove possibility of accidentally
2020
# exchanging currencies
21-
def exchange_with(from, to_currency, &block)
21+
def exchange_with(from, to_currency, &)
2222
raise DifferentCurrencyError, "No exchanging of currencies allowed: #{from} #{from.currency} to #{to_currency}"
2323
end
2424
end

lib/money/bank/variable_exchange.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class VariableExchange < Base
5858
# @param [RateStore] st An exchange rate store, used to persist exchange rate pairs.
5959
# @yield [n] Optional block to use when rounding after exchanging one
6060
# currency for another. See +Money::bank::base+
61-
def initialize(st = Money::RatesStore::Memory.new, &block)
61+
def initialize(st = Money::RatesStore::Memory.new, &)
6262
@store = st
63-
super(&block)
63+
super(&)
6464
end
6565

6666
def store
@@ -108,15 +108,15 @@ def marshal_load(arr)
108108
#
109109
# # Exchange 100 CAD to USD:
110110
# bank.exchange_with(c2, "USD") #=> #<Money fractional:8031 currency:USD>
111-
def exchange_with(from, to_currency, &block)
111+
def exchange_with(from, to_currency, &)
112112
to_currency = Currency.wrap(to_currency)
113113
if from.currency == to_currency
114114
from
115115
else
116116
if rate = get_rate(from.currency, to_currency)
117117
fractional = calculate_fractional(from, to_currency)
118118
from.dup_with(
119-
fractional: exchange(fractional, rate, &block),
119+
fractional: exchange(fractional, rate, &),
120120
currency: to_currency,
121121
bank: self,
122122
)
@@ -133,7 +133,7 @@ def calculate_fractional(from, to_currency)
133133
)
134134
end
135135

136-
def exchange(fractional, rate, &block)
136+
def exchange(fractional, rate, &)
137137
ex = fractional * BigDecimal(rate.to_s)
138138
if block_given?
139139
yield ex

lib/money/money.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ def to_money(given_currency = nil)
509509
# Money.new(2000, "USD").exchange_to("EUR")
510510
# Money.new(2000, "USD").exchange_to("EUR") {|x| x.round}
511511
# Money.new(2000, "USD").exchange_to(Currency.new("EUR"))
512-
def exchange_to(other_currency, &rounding_method)
512+
def exchange_to(other_currency, &)
513513
other_currency = Currency.wrap(other_currency)
514514
if self.currency == other_currency
515515
self
516516
else
517-
@bank.exchange_with(self, other_currency, &rounding_method)
517+
@bank.exchange_with(self, other_currency, &)
518518
end
519519
end
520520

lib/money/rates_store/memory.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def marshal_dump
7272
end
7373

7474
# Wraps block execution in a thread-safe transaction
75-
def transaction(&block)
75+
def transaction(&)
7676
guard.synchronize do
7777
yield
7878
end
@@ -90,7 +90,7 @@ def transaction(&block)
9090
# store.each_rate do |iso_from, iso_to, rate|
9191
# puts [iso_from, iso_to, rate].join
9292
# end
93-
def each_rate(&block)
93+
def each_rate(&)
9494
return to_enum(:each_rate) unless block_given?
9595

9696
guard.synchronize do

0 commit comments

Comments
 (0)