Skip to content

Commit 5ba273d

Browse files
authored
Lint: Fix Style/Alias cop (#1196)
1 parent cd75d9c commit 5ba273d

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

.rubocop_todo.yml

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

lib/money/currency.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ def stringify_keys
278278
:disambiguate_symbol, :html_entity, :subunit, :subunit_to_unit, :decimal_mark,
279279
:thousands_separator, :symbol_first, :smallest_denomination, :format
280280

281-
alias_method :separator, :decimal_mark
282-
alias_method :delimiter, :thousands_separator
283-
alias_method :eql?, :==
281+
alias separator decimal_mark
282+
alias delimiter thousands_separator
283+
alias eql? ==
284284

285285
# Create a new +Currency+ object.
286286
#

lib/money/money.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class << self
168168
# @attr_writer rounding_mode Use this to specify the rounding mode
169169
attr_writer :rounding_mode
170170

171-
alias_method :from_cents, :new
171+
alias from_cents new
172172
end
173173

174174
# @!attribute default_currency
@@ -578,7 +578,8 @@ def allocate(parts)
578578
amounts = Money::Allocation.generate(fractional, parts, !Money.default_infinite_precision)
579579
amounts.map { |amount| dup_with(fractional: amount) }
580580
end
581-
alias_method :split, :allocate
581+
582+
alias split allocate
582583

583584
# Round the monetary amount to smallest unit of coinage.
584585
#

lib/money/money/constructors.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module Constructors
1313
def empty(currency = default_currency)
1414
new(0, currency)
1515
end
16-
alias_method :zero, :empty
16+
17+
alias zero empty
1718

1819
# Creates a new Money object of the given value, using the Canadian
1920
# dollar currency.
@@ -29,7 +30,8 @@ def empty(currency = default_currency)
2930
def ca_dollar(cents)
3031
new(cents, "CAD")
3132
end
32-
alias_method :cad, :ca_dollar
33+
34+
alias cad ca_dollar
3335

3436
# Creates a new Money object of the given value, using the American dollar
3537
# currency.
@@ -45,7 +47,8 @@ def ca_dollar(cents)
4547
def us_dollar(cents)
4648
new(cents, "USD")
4749
end
48-
alias_method :usd, :us_dollar
50+
51+
alias usd us_dollar
4952

5053
# Creates a new Money object of the given value, using the Euro currency.
5154
#
@@ -60,7 +63,8 @@ def us_dollar(cents)
6063
def euro(cents)
6164
new(cents, "EUR")
6265
end
63-
alias_method :eur, :euro
66+
67+
alias eur euro
6468

6569
# Creates a new Money object of the given value, in British pounds.
6670
#
@@ -75,6 +79,7 @@ def euro(cents)
7579
def pound_sterling(pence)
7680
new(pence, "GBP")
7781
end
78-
alias_method :gbp, :pound_sterling
82+
83+
alias gbp pound_sterling
7984
end
8085
end

lib/money/money/formatter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ def decimal_mark
209209
lookup :decimal_mark
210210
end
211211

212-
alias_method :delimiter, :thousands_separator
213-
alias_method :separator, :decimal_mark
212+
alias delimiter thousands_separator
213+
alias separator decimal_mark
214214

215215
private
216216

0 commit comments

Comments
 (0)