module Rush::HeadTail
Mixin for array and string for methods I wish they had.
Public Instance Methods
head(n)
click to toggle source
# File lib/rush/head_tail.rb, line 3 def head(n) slice(0, n) end
tail(n)
click to toggle source
# File lib/rush/head_tail.rb, line 7 def tail(n) n = [ n, length ].min slice(-n, n) end