aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/enumerable.rb
Commit message (Collapse)AuthorAgeFilesLines
* update AS/core_ext docs [ci skip]Francesco Rodriguez2012-09-121-5/+6
|
* Fix Range#sum optimized versionAlexey Vakhov2012-05-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | At 1bd4d1c67459a91415ee73a8f55d2309c0d62a87 was added Range#sum optimized version for arithmetic progressions. This improvment injected a defect with not integer range boundaries. The defect was fixed by e0adfa82c05f9c975005f102b4bcaebfcd17d241. The second commit really disabled optimization at all because in Ruby integer-valued numbers are instances of Fixnum and Bignum classes. We should #use is_a? (#kind_of?) method instead #instance_of? to check if value is numerical: 1.class # => Fixnum 1.instance_of?(Integer) # => false 1.is_a?(Integer) # => true -100_000_000_000.class # => Bignum -100_000_000_000.instance_of?(Integer) # => false -100_000_000_000.is_a?(Integer) # => true Moreover original implementation of Range#sum has a defect with reverse range boundaries. If the first boundary is less than the second range is empty. Current commit fixes and tests this case too.
* removing unnecessary 'examples' noise from activesupportFrancesco Rodriguez2012-05-131-2/+2
|
* String quotes and trailing spacesAlexey Gaziev2012-04-291-1/+1
|
* AS core_ext refactoring pt.2Alexey Gaziev2012-04-291-3/+6
|
* AS core_ext refactoringAlexey Gaziev2012-04-291-3/+6
|
* remove Enumerable#each_with_object againSergey Nartimov2011-12-231-21/+0
| | | | it come back occasionally in 367741ef
* remove conflict markerVijay Dev2011-12-231-1/+0
|
* Revert "Added Enumerable#pluck to wrap the common pattern of ↵Aaron Patterson2011-12-221-5/+20
| | | | | | | | | | | | collect(&:method) *DHH*" This reverts commit 4d20de8a50d889a09e6f5642984775fe796ca943. Conflicts: activesupport/CHANGELOG.md activesupport/lib/active_support/core_ext/enumerable.rb activesupport/test/core_ext/enumerable_test.rb
* remove Enumerable#each_with_object from core_ext as it is present in ruby 1.9lest2011-12-211-21/+0
|
* Initial pass at removing dead 1.8.x code from Active Support.José Valim2011-12-201-37/+0
| | | | | | There are a bunch of other implicit branches that adds 1.8.x specific code that still needs to be removed. Pull requests for those cases are welcome.
* Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*David Heinemeier Hansson2011-12-021-0/+7
|
* docs formatting changesVijay Dev2011-09-011-2/+2
|
* Trivial optimization for Enumerable#each_with_objectMarc-Andre Lafortune2011-07-231-2/+2
|
* Insure that Enumerable#index_by, group_by, ... return EnumeratorsMarc-Andre Lafortune2011-07-231-0/+3
|
* Make Enumerable#many? iterate only over what is necessaryMarc-Andre Lafortune2011-07-231-3/+10
|
* Make Enumerable#many? not rely on #sizeMarc-Andre Lafortune2011-07-231-2/+2
|
* #many? uses count instead of select - a bit fasterJulius Markūnas2011-07-111-1/+1
|
* Clarify comment by removing french reference ('a la'). Should improve ↵Ben Orenstein2011-03-051-1/+1
| | | | readability for non-native english speakers.
* speed up index_by by removing a lolinjectAaron Patterson2010-10-011-4/+1
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-4/+4
| | | | 's/[ \t]*$//' -i {} \;)
* edit pass to apply API guideline wrt the use of "# =>" in example codeXavier Noria2010-07-301-1/+2
|
* Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if ↵David Heinemeier Hansson2009-12-141-0/+5
| | | | !x.include?/else calls [DHH]
* Enumerable#none? is not needed for Ruby >= 1.8.7Xavier Noria2009-11-091-9/+0
|
* Remove unnecessary &block from Range#sum and add tests for (num..float).sumPratik Naik2009-08-091-1/+1
|
* Optimize Range#sum only for integers [#2489]José Valim2009-08-091-2/+3
|
* Optimize Range#sum to use arithmetic progression when a block is not given ↵José Valim2009-08-091-0/+9
| | | | | | [#2489]. Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Enumerable#sum now works will all enumerables, even if they don't respond to ↵Marc-Andre Lafortune2009-08-081-4/+2
| | | | | | | | :size [#2489 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge docrailsPratik Naik2009-07-251-1/+1
|
* Simplify Enumerable#each_with_objectJeremy Kemper2009-03-211-4/+3
|
* Enumerable#none? conforms to Ruby 1.8.7 behaviorJeremy Kemper2008-11-191-3/+3
|
* Update doc to make more senseDavid Heinemeier Hansson2008-11-191-1/+1
|
* Added Enumerable#none? to check that none of the elements match the block ↵Damian Janowski2008-11-191-0/+9
| | | | | | [#1408 state:committed] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Don't shadow arg with block varJeremy Kemper2008-09-081-2/+2
|
* Add each_with_object from 1.9 for a more convenient alternative to inject.Adam Keys2008-09-031-1/+21
| | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#962 state:committed]
* Added block-handling to Enumerable#many? (Damian Janowski) [#452 state:resolved]David Heinemeier Hansson2008-06-201-1/+3
|
* Change Enumberal#several? to Enumberal#many?David Heinemeier Hansson2008-06-131-1/+1
|
* Merge branch 'master' of git@github.com:rails/railsDavid Heinemeier Hansson2008-06-121-3/+14
|\
| * Rubinious: work around h[k] ||= v returning []= result instead of vJeremy Kemper2008-06-101-3/+14
| |
* | Added Enumberable#several? to encapsulate collection.size > 1 [DHH]David Heinemeier Hansson2008-06-121-0/+5
|/
* Improve documentation coverage and markupXavier Noria2008-05-021-10/+11
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.8.7 compat: override unordered Enumerable#group_byJeremy Kemper2008-04-201-1/+4
|
* Improve documentation.Pratik Naik2008-03-261-5/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Enumerable#group_by uses ActiveSupport::OrderedHashJeremy Kemper2008-01-231-15/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8700 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix up Enumerable#group_byJeremy Kemper2008-01-091-7/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8604 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Changed the implementation of Enumerable#group_by to use a double array ↵David Heinemeier Hansson2007-12-311-2/+7
| | | | | | approach instead of a hash such that the insert order is honored [DHH/Marcel] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8516 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Some 1.9 forward compatibilityJeremy Kemper2007-09-141-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Expose methods added to Enumerable in the documentation, such as group_by. ↵Marcel Molina2006-10-221-2/+2
| | | | | | Closes #6170. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5334 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Optional identity for Enumerable#sum defaults to zero. Closes #5657.Jeremy Kemper2006-07-091-1/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4599 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Enumerable#sum without blocks. Closes #5505. Don't assume 0 identity for sum.Jeremy Kemper2006-06-251-5/+12
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4495 5ecf4fe2-1ee6-0310-87b1-e25e094e27de