Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/array.rb
Overview
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Instance Method Summary collapse
Instance Method Details
#nice_or ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/array.rb', line 18 def nice_or case size when 0; raise "nice_or should not be called on an empty array" when 1; self[0] when 2; "#{self[0] } or #{self[-1]}" else "#{self[0 .. -2].join(', ')} or #{self[-1]}" end end |