Created
November 21, 2012 22:54
-
-
Save capoferro/4128376 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ArrayExt | |
| def add_element(element, side = :tail) | |
| case side | |
| when :head | |
| unshift element | |
| when :tail | |
| self << element | |
| else | |
| raise ArgumentError.new('argument \'side\' must be one of :head, :tail') | |
| end | |
| end | |
| end | |
| class Array | |
| include ArrayExt | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment