Method: Array#init
- Defined in:
- lib/ruby/jruby_hack.rb
#init(n = 1) ⇒ Array
Selects all elements except the last ‘n` ones.
58 59 60 61 |
# File 'lib/ruby/jruby_hack.rb', line 58 def init(n = 1) raise ArgumentError, "n cannot be negative" if n < 0 slice(0..-(n + 1)) or [] end |