Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zaeleus/5156053 to your computer and use it in GitHub Desktop.
Save zaeleus/5156053 to your computer and use it in GitHub Desktop.
From 2587a13c97b654175d7cf68f2b969d37d42c5fea Mon Sep 17 00:00:00 2001
From: Michael Macias <[email protected]>
Date: Wed, 13 Mar 2013 15:42:34 -0500
Subject: [PATCH] Add NArray#map alias for NArray#collect
---
narray.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/narray.c b/narray.c
index 7ea9a72..fc823cb 100644
--- a/narray.c
+++ b/narray.c
@@ -1240,6 +1240,8 @@ void
rb_define_method(cNArray, "each", na_each,0);
rb_define_method(cNArray, "collect", na_collect,0);
rb_define_method(cNArray, "collect!", na_collect_bang,0);
+ rb_define_alias(cNArray, "map", "collect");
+ rb_define_alias(cNArray, "map!", "collect!");
rb_define_method(cNArray, "to_s", na_to_s, 0);
rb_define_method(cNArray, "to_f", na_to_float, 0);
rb_define_method(cNArray, "to_i", na_to_integer, 0);
--
1.8.1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment