Skip to content

Commit

Permalink
+ String#{+|-}@ (Ruby 2.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Apr 26, 2017
1 parent fadb66d commit 83feced
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Compatible with Ruby itself, JRuby and Rubinius.
* Numeric
* +negative?+
* +positive?+
* String
* unary + and -
* Struct
* +dig+

Expand Down
7 changes: 7 additions & 0 deletions lib/backports/2.3.0/string/uminus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
unless String.method_defined? :-@
class String
def -@
frozen? ? self : dup.freeze
end
end
end
7 changes: 7 additions & 0 deletions lib/backports/2.3.0/string/uplus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
unless String.method_defined? :+@
class String
def +@
frozen? ? dup : self
end
end
end
1 change: 1 addition & 0 deletions spec/tags/1.8.6/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/1.8.7/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/1.9.1/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/1.9.2/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/2.0.0/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/2.1.0/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/2.2.0/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file
1 change: 1 addition & 0 deletions spec/tags/2.3.0/core/string/uplus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:String#+@ returns mutable copy despite freeze-magic-comment in file

0 comments on commit 83feced

Please sign in to comment.