aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-201-1/+0
| | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* Add `Array#extract!`bogdanvlviv2018-08-141-0/+1
| | | | | | | | | | | The method removes and returns the elements for which the block returns a true value. If no block is given, an Enumerator is returned instead. ``` numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] numbers # => [0, 2, 4, 6, 8] ```
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-7/+7
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-7/+7
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-7/+7
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Revert "Remove Array#inquiry"Rafael Mendonça França2015-03-301-0/+1
| | | | | | This reverts commit 9420de59f5b7f5ceac77e28e6c326ec145f71f80. Reason: Turns out we want to keep this method.
* Remove Array#inquiryRafael Mendonça França2015-03-271-1/+0
| | | | | We are promoting too much a feature that will not be widler used. So for now lets keep just the ArrayInquirer constructor.
* Add ActiveSupport::ArrayInquirer and Array#inquiryGeorge Claghorn2015-03-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its string-like contents. For example, `request.variant` returns an `ArrayInquirer` object. To check a request's variants, you can call: request.variant.phone? request.variant.any?(:phone, :tablet) ...instead of: request.variant.include?(:phone) request.variant.any? { |v| v.in?([:phone, :tablet]) } `Array#inquiry` is a shortcut for wrapping the receiving array in an `ArrayInquirer`: pets = [:cat, :dog] pets.cat? # => true pets.ferret? # => false pets.any?(:cat, :ferret} # => true
* Remove deprecated Array#uniq_by and Array#uniq_by!Carlos Antonio da Silva2013-07-011-1/+0
| | | | Use native Array#uniq and Array#uniq! instead.
* Keep all methods in object/deep_dupPiotr Sarnacki2012-05-061-1/+0
|
* Nice logic for deep_dup in railsAlexey Gaziev2012-05-061-0/+1
|
* remove Array#sample from core_extVasiliy Ermolovich2011-12-211-1/+0
|
* Added Array#prepend as an alias for Array#unshift and Array#append as an ↵David Heinemeier Hansson2011-08-151-0/+1
| | | | alias for Array#<< [DHH]
* Add uniq_by and uniq_by! to Array.José Valim and Mikel Lindsaar2010-01-241-0/+1
|
* Convert array extension modules to class reopensJeremy Kemper2009-03-211-2/+5
|
* * Introduce ActiveSupport.core_ext Integer, %w(conversions time etc)Jeremy Kemper2009-03-211-15/+3
| | | | | | * Convert some extension modules to simply reopening the class * Remove deprecated Float time extensions * Fold Base64 extension into ActiveSupport::Base64 since stdlib Base64 is gone
* Introduce Array.wrap(foo) to wrap the argument in an array unless it's ↵Jeremy Kemper2009-02-061-0/+2
| | | | already an array. Wraps nil as an empty array. Use instead of Array(foo) and foo.to_a since they treat String as Enumerable.
* Added Array#from and Array#to that behaves just from String#from and ↵David Heinemeier Hansson2007-11-271-0/+2
| | | | | | String#to [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ruby 1.9 compat, consistent load pathsJeremy Kemper2007-10-021-4/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Array#rand (closes #9170) [norbert]David Heinemeier Hansson2007-09-151-2/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7486 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Array#extract_options! to encapsulate the pattern of getting an ↵David Heinemeier Hansson2007-07-241-0/+2
| | | | | | options hash out of a variable number of parameters (closes #8759) [norbert] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7217 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Array#to_s(:db) that'll produce a comma-separated list of ids [DHH] ↵David Heinemeier Hansson2006-05-311-39/+2
| | | | | | Split Grouping into its own file git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4387 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make Array#in_groups_of just return the grouped collection if a block isn't ↵Marcel Molina2006-05-171-1/+5
| | | | | | given. [Marcel Molina Jr.] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4345 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add Array#split for dividing arrays into one or more subarrays by value or blockSam Stephenson2006-04-131-0/+19
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4208 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add Enumerable#group_by and Array#in_groups_ofMarcel Molina2006-03-011-0/+16
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3726 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Array#to_sentence that'll turn ['one', 'two', 'three'] into 'one, two, ↵David Heinemeier Hansson2005-09-111-2/+2
| | | | | | and three' #2157 [m.stienstra@fngtps.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2185 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improved performance of Routes generation by a factor of 5 #1434 [Nicholas ↵David Heinemeier Hansson2005-06-241-0/+5
Seckar] Added named routes (NEEDS BETTER DESCRIPTION) #1434 [Nicholas Seckar] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1496 5ecf4fe2-1ee6-0310-87b1-e25e094e27de