-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending Array #2
Comments
Seems possibly futile since this is a 2 year old issue, but I strongly second this. Rush is really cool, but the way it clutters up Array is just messy and error prone. I ran into a real-life case of this just now on a Rails 3 project on Heroku. The The result was the evocation of a few "What the hell??" exclamations when I started seeing errors complaining about my class not responding to A Rush::FileArray or something would be a great thing, as opposed to the assumption that all Arrays in the app are lists of files. |
+1 for every Array extension method it defines |
I just found that including the rush gem in my Rails 3.2 app slows down large queries by around 3.5 times. I haven't narrowed it down, but I'm guessing it is these Array extensions that cause the slow down. For some real data, here is a benchmark that collects around 13k AR objects: with rush 0.6.8 gem: |
Let me be a little more adamant here: +10E100! If you want Rush to a successful app/library make a FileArray and use it. |
Hi, I'm looking at using Rush for on my projects, and if I do I would like to contribute back to Rush, as I will need many more commands than Rush currently defines.
I need to look into it a bit more, but I do see one issue I would want to see addressed, that is the extension of the Array class. There is the potential here for conflicts with the built-in Array methods and other people's Array extensions (of which I use quite a few). A more robust approach would be to use a subclass of Array, for the sake of discussion, let's call it FileArray. The Rush methods would return a Rush::FileArray instead of an Array where applicable. A single method can be added to Array to convert a regular array to a FileArray, perhaps #files or #to_files.
The text was updated successfully, but these errors were encountered: