1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

26 commits

Author SHA1 Message Date
chaitanyav
9958950f78 Add OrderedHash#invert to preserve order in ruby 1.8 [#4875]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 12:05:25 +02:00
Paul Mucur
158e22dae0 Alias ActiveSupport::OrderedHash#update to ActiveSupport::OrderedHash.merge!
This ensures that an OrderedHash's keys are set up appropriately when using update.

[#4973 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 15:02:20 -07:00
Xavier Noria
50df162a2b explains why AS::OrderedHash does not leverage inheritance 2010-06-13 22:02:29 +02:00
Santiago Pastorino
6d19a4a664 Change implementation to do it without asking each time for block_given?
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-06-13 07:27:26 +02:00
Xavier Noria
36143d26cb revises implementation of AS::OrderedHash#merge! 2010-06-13 06:37:54 +02:00
Xavier Noria
3359af63a5 Revert "hash merging with a block ignores non-existing keys altogether"
This reverts commit 72f9fec607.

It is wrong, this feature is a little undocumented, doing some research.
2010-06-13 05:53:42 +02:00
Xavier Noria
72f9fec607 hash merging with a block ignores non-existing keys altogether 2010-06-13 05:09:31 +02:00
Paul Mucur
58e21a4a0d Support passing a block to ActiveSupport::OrderedHash's merge and merge! [#4838 state:committed]
For better consistency with Ruby's own Hash implementation.

Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-06-13 04:19:35 +02:00
Jeremy Kemper
e77a0311e5 Refactor for readability 2010-04-09 19:33:55 -07:00
snusnu
016f15dc69 active_support/ordered_hash now requires yaml 2010-01-27 18:13:06 -08:00
Gregor Schmidt
7b8c6472ff Adding custom yaml (de-)serialization for OrderedHash
[#3608 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-01-27 15:29:06 -08:00
Chris Hapgood
6c59e5a558 Fix OrderedHash#replace
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-11-05 21:17:13 +13:00
Brian Abreu
d036899717 Fixed ActiveSupport::OrderedHash::[] work identically to ::Hash::[] in ruby 1.8.7 [#2832 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 12:01:05 -07:00
Douglas F Shearer
e1854e0b19 ActiveSupport::OrderedHash[1,2,3,4] creates an OrderedHash instead of a Hash.
[#2615 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-11 11:45:57 -07:00
Ken Collins
9e0cfdb7f9 ActiveSupport::OrderedHash#to_a method returns an ordered set of arrays. Matches ruby1.9's Hash#to_a.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2629 state:committed]
2009-05-10 13:04:46 +12:00
Jeremy Kemper
9d13b9eed8 Fix OrderedHash#inspect recursion 2009-03-04 16:21:44 -08:00
Jeremy Kemper
cb53452438 Fix OrderedHash#to_hash to return self instead of a new hash with self as default value 2009-03-03 19:10:33 -08:00
Greg Borenstein
f4bf318db0 add an inspect method to OrderedHash to make it clear that it is not a species of Array
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1782 state:committed]
2009-01-26 16:26:37 +13:00
Brandon Keepers
452cd74d81 Dup keys in OrderedHash to prevent them from being modified [#1676 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2009-01-16 17:23:43 +00:00
Frederick Cheung
4dcd8f01af Make delete_if/reject faster and fix other mutators
[#1559 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-15 15:34:29 +01:00
Eloy Duran
7394d12dc7 Fixed ActiveSupport::OrderedHash #delete_if, #reject!, and #reject, which did not sync the @keys after the operation.
This probably holds true for other mutating methods as well.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-12-11 14:32:20 +01:00
Frederick Cheung
355f41d8aa Rework ActiveSupport::OrderedHash to make lookups faster
[#1352 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-10 09:07:47 -08:00
Christoffer Sawicki
05a938c5f7 Added ActiveSupport::OrderedHash#each_key and ActiveSupport::OrderedHash#each_value [#1410 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-11-26 14:54:35 +01:00
Jeremy Kemper
f5cbad21ac Rubinious: work around h[k] ||= v returning []= result instead of v 2008-06-10 14:01:16 -07:00
Steve Purcell
7cfa6ec8a3 Add more standard Hash methods to ActiveSupport::OrderedHash [#314 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-06-03 14:15:33 -05:00
Joshua Peek
49846f8586 Create a seperate file for ActiveSupport::OrderedHash. 2008-05-14 12:48:37 -05:00