Skip to content

Commit

Permalink
add demo Array#splice :test:
Browse files Browse the repository at this point in the history
Fixed missing word in splice.rb
  • Loading branch information
anithri committed Apr 13, 2015
1 parent b6193b6 commit 5d48924
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions demo/core/array/splice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Array#splice

require 'facets/array/splice'

Splice acts as a combination of #slice! and #store. If one argument is given it
calls #slice!, if two are given it calls #store.

a = [1,2,3]
a.splice(1).assert == 2
a.assert == [1,3]

b = [1,2,3]
b.splice(1,4).assert == 4
b.assert == [1,4,3]
2 changes: 1 addition & 1 deletion lib/core/facets/array/splice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Array

# Splice acts a combination of #slice! and #store.
# Splice acts as a combination of #slice! and #store.
# If two arguments are given it calls #store.
# If a single argument is given it calls slice!.
#
Expand Down

0 comments on commit 5d48924

Please sign in to comment.