lib/core/facets/string/splice.rb in facets-2.8.4 vs lib/core/facets/string/splice.rb in facets-2.9.0.pre.1
- old
+ new
@@ -1,18 +1,17 @@
+require 'facets/string/store'
+
class String
- # This is basically the same as #store,
- # but it acts like slice! when given only
- # one argument.
+ # String#slice is essentially the same as #store.
#
- # Essentlay #slice, but writes rather than
- # reads.
- #
# a = "HELLO"
- # a.splice("X", 1)
+ # a.splice(1, "X")
# a #=> "HXLLO"
#
+ # But it acts like #slice! when given a single argument.
+ #
# a = "HELLO"
# a.splice(1) #=> "E"
# a #=> "HLLO"
#
# CREDIT: Trans
@@ -27,11 +26,8 @@
else
slice!(idx,1)
end
end
end
-
- # Alias for []=.
- alias_method :store, :[]=
end