Timeline for Convert string array to object with true/false flags
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 5, 2015 at 21:58 | comment | added | tokland |
1) I use to_set not to remove duplicates but because Set#include? is O(1) while Array#include? is O(n). Not really needed with those data sizes, but feels conceptually more fitting. 2) In a bare Ruby script, yes, but Rails already includes set . Doesn't hurt to write it, though.
|
|
Jan 5, 2015 at 20:57 | comment | added | Mohamad |
Curious, why to_set ? To remove duplicates? If so, why not use array.uniq ? And doesn't to_set require you to require set?-e.g. require 'set'
|
|
Jan 5, 2015 at 20:00 | history | edited | tokland | CC BY-SA 3.0 |
added 7 characters in body
|
Jan 5, 2015 at 12:06 | history | answered | tokland | CC BY-SA 3.0 |