Skip to content

Commit

Permalink
tmp: accept frozen strings
Browse files Browse the repository at this point in the history
Ref: ruby/ruby#10235

As discussed upstream, the mutability is only used in one spec, `path.rb`:

```ruby
    @name = +"file_to_path"
    @path = tmp(@name)
```

For all the others it doesn't matter if the argument is mutated or not.
  • Loading branch information
byroot committed Mar 13, 2024
1 parent 58050d7 commit 101de07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mspec/helpers/tmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end
SPEC_TEMP_DIR = spec_temp_dir

SPEC_TEMP_UNIQUIFIER = "0"
SPEC_TEMP_UNIQUIFIER = +"0"

at_exit do
begin
Expand Down Expand Up @@ -41,6 +41,7 @@ def tmp(name, uniquify = true)
if uniquify and !name.empty?
slash = name.rindex "/"
index = slash ? slash + 1 : 0
name = +name
name.insert index, "#{SPEC_TEMP_UNIQUIFIER.succ!}-"
end

Expand Down

0 comments on commit 101de07

Please sign in to comment.