Commit Graph

33 Commits

Author SHA1 Message Date
Santiago Pastorino
092a4e296d just < 1.9 is fine and 1.9.1 is not supported 2011-02-03 19:27:43 -02:00
Gabriel Horner
c0b4db0c28 fix OrderedHash#each* methods to return Enumerators when called without a block [#6366 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 19:26:36 -02:00
Gabriel Horner
9a0f43d3c1 OrderedHash#each* methods return self like Hash does [#6364 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 13:40:36 -02:00
Aaron Patterson
4fabad7cf1 test that the custom ordered hash can be round-tripped 2011-01-04 15:07:15 -08:00
Aaron Patterson
b1dc9c004e use dots for method calls 2011-01-04 15:07:15 -08:00
James A. Rosen
697f4851b8 OrderedHash#select now preserves order [#5843 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 17:27:07 -02:00
Thiago Pradi
3c9bf6e1dc Exception handling more readable
[#5601 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 12:18:51 -07:00
Santiago Pastorino
e1d4e78b15 Removes unused vars
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-24 01:19:44 +02:00
Santiago Pastorino
4a0c514eb4 AS json refactor, move to_json implementation to core_ext and a cleanup a bit the code 2010-07-01 12:04:11 -07:00
José Valim
3782010377 Oops. Make previous commit pass on 1.9.2. 2010-06-26 12:14:25 +02:00
José Valim
aa48ab05f4 Tidy up tests in previous commit since they did not assure an OrderedHash is returned (the test would pass for an array and would pass by chance for hashes).
[#4875 state:resolved]
2010-06-26 12:09:56 +02:00
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
José Valim
7bd85a8fc2 Work around the fact the JSON gem was overwriting to_json implementation for all Ruby core classes.
This is required because the JSON gem is incompatible with Rails behavior and was not allowing ActiveModel::Errors to be serialized.
So we need to ensure Rails implementation is the one triggered. [#4890 state:resolved]
2010-06-26 12:01:13 +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
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 72f9fec607c4a72b2e88995d0cb32b16b96e9068.

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 Barry
9183eaebed re-organized test for merge into separate tests
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-06-13 04:19:35 +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
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
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
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