Skip to content

Commit

Permalink
Merge pull request #2330 from herwinw/string_dedup
Browse files Browse the repository at this point in the history
Add String#dedup as an alias for String#@-
  • Loading branch information
herwinw committed Nov 13, 2024
2 parents ecf53b3 + 5cced51 commit 5fb4110
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/natalie/compiler/binding_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def generate_name
gen.binding('String', '*', 'StringObject', 'mul', argc: 1, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '+', 'StringObject', 'add', argc: 1, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '+@', 'StringObject', 'uplus', argc: 0, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '-@', 'StringObject', 'uminus', argc: 0, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '-@', 'StringObject', 'uminus', argc: 0, pass_env: true, pass_block: false, aliases: ['dedup'], return_type: :Object)
gen.binding('String', '<<', 'StringObject', 'ltlt', argc: 1, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '<=>', 'StringObject', 'cmp', argc: 1, pass_env: true, pass_block: false, return_type: :Object)
gen.binding('String', '==', 'StringObject', 'eq', argc: 1, pass_env: true, pass_block: false, aliases: ['==='], return_type: :bool)
Expand Down
8 changes: 8 additions & 0 deletions spec/core/string/dedup_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative '../../spec_helper'
require_relative 'shared/dedup'

describe 'String#dedup' do
ruby_version_is '3.2' do
it_behaves_like :string_dedup, :dedup
end
end

0 comments on commit 5fb4110

Please sign in to comment.