Skip to content

Commit b33d2c4

Browse files
authored
Lint: Fix Style cops (#1203)
1 parent 7516379 commit b33d2c4

File tree

8 files changed

+15
-62
lines changed

8 files changed

+15
-62
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 48 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def initialize(&block)
7878
# +Money::Bank+ class.
7979
#
8080
# @return [self]
81-
def setup
82-
end
81+
def setup; end
8382

8483
# Exchanges the given +Money+ object to a new +Money+ object in
8584
# +to_currency+.

lib/money/money/allocation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def self.generate(amount, parts, decimal_cutoff = true)
4545

4646
parts_sum = parts.sum
4747

48-
until parts.empty? do
48+
until parts.empty?
4949
part = parts.pop
5050

5151
current_split = 0

lib/money/money/arithmetic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def zero?
340340
# Money.new(100).nonzero? #=> #<Money @fractional=100>
341341
# Money.new(0).nonzero? #=> nil
342342
def nonzero?
343-
fractional != 0 ? self : nil
343+
fractional == 0 ? nil : self
344344
end
345345

346346
# Used to make Money instance handle the operations when arguments order is reversed

lib/money/money/formatting_rules.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def has_key?(key)
3434
#
3535
# @return [Hash]
3636
def normalize_formatting_rules(rules)
37-
if rules.size == 0
37+
if rules.empty?
3838
rules = {}
3939
elsif rules.size == 1
4040
rules = rules.pop

spec/currency_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ def to_s
243243
end
244244
end
245245

246+
# rubocop:disable Style/MapIntoArray
246247
describe ".each" do
247248
it "yields each currency to the block" do
248249
expect(described_class).to respond_to(:each)
@@ -257,6 +258,7 @@ def to_s
257258
expect(currencies[-1]).to eq described_class.all[-1]
258259
end
259260
end
261+
# rubocop:enable Style/MapIntoArray
260262

261263
it "implements Enumerable" do
262264
expect(described_class).to respond_to(:all?)
@@ -483,13 +485,13 @@ def to_s
483485
cad = described_class.find(:cad)
484486

485487
described_class.register(
486-
:priority => 100,
487-
:iso_code => cad.iso_code,
488-
:name => cad.name,
489-
:subunit => cad.subunit,
490-
:subunit_to_unit => cad.subunit_to_unit,
491-
:thousands_separator => cad.thousands_separator,
492-
:decimal_mark => modified_mark,
488+
priority: 100,
489+
iso_code: cad.iso_code,
490+
name: cad.name,
491+
subunit: cad.subunit,
492+
subunit_to_unit: cad.subunit_to_unit,
493+
thousands_separator: cad.thousands_separator,
494+
decimal_mark: modified_mark,
493495
)
494496
end
495497

spec/money/arithmetic_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@
853853
end
854854
end
855855

856-
%w(+ - / divmod remainder).each do |op|
856+
%w[+ - / divmod remainder].each do |op|
857857
describe "##{op}" do
858858
let(:instance) { Money.usd(1) }
859859

spec/money_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@
931931

932932
it "keeps subclasses intact" do
933933
special_money_class = Class.new(Money)
934-
expect(special_money_class.new(005).allocate([1]).first).to be_a special_money_class
934+
expect(special_money_class.new(5).allocate([1]).first).to be_a special_money_class
935935
end
936936

937937
context "with infinite_precision", :default_infinite_precision_true do

0 commit comments

Comments
 (0)