Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for upcoming default frozen strings #1662

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions exercises/concept/bird-count/bird_count_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require 'minitest/autorun'
require_relative 'bird_count'

Expand Down
2 changes: 0 additions & 2 deletions exercises/concept/lasagna/lasagna_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require 'minitest/autorun'
require_relative 'lasagna'

Expand Down
2 changes: 0 additions & 2 deletions exercises/concept/log-line-parser/log_line_parser_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require 'minitest/autorun'
require_relative 'log_line_parser'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ def test_decode_with_one_rail
def test_decode_with_two_rails
skip
assert_equal 'XOXOXOXOXOXOXOXOXO',
RailFenceCipher.decode('XXXXXXXXXOOOOOOOOO', 2)
RailFenceCipher.decode(+'XXXXXXXXXOOOOOOOOO', 2)
end

def test_decode_with_three_rails
skip
assert_equal 'THEDEVILISINTHEDETAILS',
RailFenceCipher.decode('TEITELHDVLSNHDTISEIIEA', 3)
RailFenceCipher.decode(+'TEITELHDVLSNHDTISEIIEA', 3)
end
end
2 changes: 1 addition & 1 deletion exercises/practice/raindrops/.meta/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def convert
return number.to_s
end

s = ''
s = String.new
s << 'Pling' if pling?
s << 'Plang' if plang?
s << 'Plong' if plong?
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/roman-numerals/.meta/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Integer

def to_roman
i = self
s = ''
s = String.new
ROMAN_MAPPINGS.each do |arabic, roman|
while i >= arabic
s << roman
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/run-length-encoding/.meta/example.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class RunLengthEncoding
def self.encode(str)
str.chars.chunk { |char| char }.each_with_object('') do |chunk, out|
str.chars.chunk { |char| char }.each_with_object(+'') do |chunk, out|
out << encoded(chunk)
end
end

def self.decode(str)
str.scan(/(\d+)?(\D)/).each_with_object('') do |captures, out|
str.scan(/(\d+)?(\D)/).each_with_object(+'') do |captures, out|
out << decoded(captures)
end
end
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/say/.meta/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ def to_s
private

def say_hundreds
return '' unless hundreds?
return +'' unless hundreds?
"#{small_numbers[hundreds]} hundred"
end

def say_double_digits
return '' if double_digits.zero?
s = ' '
s = +' '
if double_digits < 20
s << small_numbers[double_digits]
else
Expand Down