aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* :nodoc: our SecureRandom patches [ci skip]Godfrey Chan2014-06-261-4/+4
| | | | | | | These methods shouldn't be added to `SecureRandom`, as they are neither secure nor random. The more appropriate place for this seems to be `Digest`, so we should move them there. (Pull request welcomed!) Marking this `:nodoc:` for now, so we don't accidentally ship it as public API. See https://github.com/rails/rails/pull/15306/files#r13055862 for details.
* Fix documentation from #15669 [ci skip]Zachary Scott2014-06-171-3/+5
|
* [ci skip] fix doc for the Hash#assert_valid_keysAditya Kapoor2014-06-171-3/+3
|
* [ci skip] BigDecimal#duplicable? returns false in 1.9.xAkshay Vishnoi2014-06-131-1/+1
|
* Revert "remove unnecssary require of `to_param`, as `to_query` is already ↵Rafael Mendonça França2014-06-114-0/+4
| | | | | | | | | | | | | | | | | | | | | require `to_param`" Revert "No need to require to_param, it is already required in to_query.rb" This reverts commits ccdd97662e1fb00c23c90d59f65c091904959561 and d697ee14264a90a39cdbe87857656d8b314ac9b7. Reason by @jeremy: These requires are not for implementation dependency. They ensure that requiring array conversions provides to_query, to_param, and other array conversion behaviors. The fact that to_query is implemented in terms of to_param is just a coincidence. If to_query removed its to_param require, then someone requiring array conversions would no longer have to_param available. This change removes these intentional dependencies on to_param in favor of implementation side effects—an undesirable move that's susceptible to regression.
* remove unnecssary require of `to_param`, as `to_query` is already require ↵Kuldeep Aggarwal2014-06-123-3/+0
| | | | `to_param`
* No need to require to_param, it is already required in to_query.rbAkshay Vishnoi2014-06-111-1/+0
|
* Correct result, previously showing wrong resultAkshay Vishnoi2014-06-041-1/+1
|
* drastically reduce object allocationsAaron Patterson2014-06-021-6/+13
| | | | | | | | | | before this change, we were allocating AS::SafeBuffer objects that were being interpolated in to a string, so the safe buffer object was being thrown away. This change only allocates a string (vs a string *and* a safebuffer) and interpolates the string. On my test application, this reduced the AS::SafeBuffer objects from 1527k per request to about 500 per request.
* reduce AS::SafeBuffer allocationsAaron Patterson2014-06-021-1/+2
| | | | | | | | | | | | html_escape_interpolated_argument is only used in mutation methods: https://github.com/rails/rails/blob/c07d09559ec171e1904b55c7ad7e8c7d586ca51b/activesupport/lib/active_support/core_ext/string/output_safety.rb#L174 https://github.com/rails/rails/blob/c07d09559ec171e1904b55c7ad7e8c7d586ca51b/activesupport/lib/active_support/core_ext/string/output_safety.rb#L179 The return value doesn't need to be converted to an AS::SafeBuffer since we know that the current object is an AS::SafeBuffer and will be mutated, and the return value from html_escape_interpolated_argument will be thrown away
* concat is a hotspot (via AV#append=), so just directly define the methodsAaron Patterson2014-06-021-4/+6
|
* [ci skip] Correct output of Hash#symbolize_keysAkshay Vishnoi2014-05-311-2/+2
|
* :scissors: removed deprecated `Numeric#ago` and friendsGodfrey Chan2014-05-301-19/+1
| | | | | | | | | | | | | | Replacements: 5.ago => 5.seconds.ago 5.until => 5.seconds.until 5.since => 5.seconds.since 5.from_now => 5.seconds.from_now The removed tests does not affect coverage – we have equivalent test cases in the tests for `AS::Duration`. See #12389 for the history and rationale behind this.
* Merge pull request #12080 from ShayDavidson/fix_datetime_partial_datesMatthew Draper2014-05-281-1/+11
|\ | | | | | | Added partial days support to `DateTime`'s `advance` method.
| * Added partial days support to `DateTime`'s `advance` method.Shay Davidson2013-08-301-5/+15
| | | | | | | | | | You can now add partial days (e.g. 2.5.days) to `DateTime` with the advance method. This was acheived by mimicing the `advance` implementation in `Time`.
* | Merge pull request #15276 from kuldeepaggarwal/fix-array-toRafael Mendonça França2014-05-231-1/+3
|\ \ | | | | | | Array#to now accept negative position also.
| * | revert 96525d63Kuldeep Aggarwal2014-05-231-1/+3
| | | | | | | | | | | | `Array#to` is working for negative position
* | | add test cases for negative position in Array#fromKuldeep Aggarwal2014-05-231-0/+2
|/ /
* | Merge pull request #10887 from sakuro/deep_transform_keys_in_nested_arraysRafael Mendonça França2014-05-201-16/+38
|\ \ | | | | | | | | | | | | | | | | | | Hash#deep_*_keys(!) recurse into nested arrays. Conflicts: activesupport/CHANGELOG.md
| * | Hash#deep_*_keys(!) recurse into nested arrays.OZAWA Sakuro2013-06-081-16/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following methods now recursively transform nested arrays, too. * Hash#deep_transform_keys * Hash#deep_transform_keys! * Hash#deep_stringify_keys * Hash#deep_stringify_keys! * Hash#deep_symbolize_keys * Hash#deep_symbolize_keys!
* | | Fix confusing exception in ActiveSupport delegationVladimir Yarotsky2014-05-201-25/+13
| | |
* | | Do not check defined?(CGI) on every call #to_queryprintercu2014-05-131-1/+1
| | |
* | | Change 'a' to 'an' [ci skip]Santosh Wadghule2014-05-091-1/+1
| | |
* | | Merge pull request #12746 from coreyward/masterRafael Mendonça França2014-05-071-11/+22
|\ \ \ | | | | | | | | | | | | Fix Hash#deep_merge bug and improve documentation — resolves #12738
| * | | Fix Hash#deep_merge bug and improve documentation — resolves #12738Corey Ward2013-12-091-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously merging into a hash with a falsy value would not result in the merge-block being called. The fix is simply to check for presence of the key in the hash. The documentation example for `deep_merge` now appropriately demonstrates what a deep merge does.
* | | | No need the else clauseRafael Mendonça França2014-05-041-2/+0
| | | |
* | | | Merge pull request #14949 from bogdan/empty-hash-array-parameterizationRafael Mendonça França2014-05-041-6/+6
|\ \ \ \ | | | | | | | | | | [Fixes #14948] Hash#to_query: right serialization for empty hash and array
| * | | | [Fixes #14948] Hash#to_query: Changed a way how empty hash and empty array ↵Bogdan Gusiev2014-05-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are serialized Empty Hash or Array should not present in serialization result {a: []}.to_query # => "" {a: {}}.to_query # => "" For more info see #14948.
* | | | | Remove deprecated file(`active_support/core_ext/object/to_json.rb`) and its ↵Kuldeep Aggarwal2014-05-041-5/+0
|/ / / / | | | | | | | | | | | | test case.
* | | | Merge pull request #14801 from kuldeepaggarwal/fix-string-inflectionRafael Mendonça França2014-04-221-1/+1
|\ \ \ \ | | | | | | | | | | Fix inconsistent behavior from String#pluralize
| * | | | Fix inconsistent behavior from String#pluralizeKuldeep Aggarwal2014-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: When calling String#pluralize with count=1 then it returned same string, but with count other than 1, returned new string. After: String#pluralize always return a new string. => Prevent mutation of a string inadvertently.
* | | | | [ci skip] builtin -> built-inAkshay Vishnoi2014-04-201-1/+1
|/ / / /
* | | | Fix inconsistent behavior from String#first/#lastErnie Miller2014-04-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While calling String#first or String#last with zero or a Fixnum < the string's length returns a new string, a Fixnum >= the string's length returns the string itself. This inconsistency can lead to inadvertent mutation of a string.
* | | | Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-04-182-1/+11
|\ \ \ \
| * | | | Correct docs as singlton true is not returned hereSteven Harman2014-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | [ci skip]
| * | | | Document LoadError core extensionsSteven Harman2014-04-111-1/+4
| | | | | | | | | | | | | | | | | | | | [ci skip]
| * | | | Add documentation for Thread#freezeSteven Harman2014-04-061-0/+7
| | | | |
* | | | | Object#duplicable?Akshay Vishnoi2014-04-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Improve tests 2. Remove unnecessary constant 3. Add docs for BigDecimal#duplicable?
* | | | | Merge pull request #14646 from deivid-rodriguez/provide_byebug_by_defaultRafael Mendonça França2014-04-111-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Improve debugging support
| * | | | | Keep debugger support only for rubies < 2.0.0David Rodríguez de Dios2014-04-081-1/+1
| | | | | |
* | | | | | Add more test case for #demodulize, Improve documentationAkshay Vishnoi2014-04-111-0/+2
| | | | | |
* | | | | | Merge pull request #12016 from roderickvd/uuid_fixesRafael Mendonça França2014-04-041-0/+47
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Auto-generate stable fixture UUIDs on PostgreSQL Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/fixtures.rb activerecord/test/cases/adapters/postgresql/uuid_test.rb activesupport/CHANGELOG.md
| * | | | | Auto-generate stable fixture UUIDs on PostgreSQL.Roderick van Domburg2014-01-071-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | Fixes: #11524
* | | | | | Move require to actual fileCarlos Antonio da Silva2014-04-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change to require all active_support/deprecation since that's the actual entry point for the deprecation methods.
* | | | | | DRY AS::SafeBuffer a bit using existing helperPavel Pravosud2014-04-021-5/+1
| | | | | |
* | | | | | Make AS::SafeBuffer#prepend act like String#prependPavel Pravosud2014-03-311-6/+13
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `#prepend` method modify instance in-place and return self instead of just returning modified value. That is exactly what `#prepend!` method was doing previously, so it's deprecated from now on.
* | | | | Deprecate Class#superclass_delegating_accessorAkshay Vishnoi2014-03-201-0/+4
| | | | |
* | | | | Minor grammer, code conventions fix [ci skip]Zoltan Kiss2014-03-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activesupport/lib/active_support/core_ext/hash/conversions.rb
* | | | | Remove deprecation on active_support/core_ext/class/attribute_accessors ↵Jeremy Kemper2014-03-151-5/+3
| | | | | | | | | | | | | | | | | | | | requires. Appropriate to keep this, users don't care that the implementation got unified.
* | | | | Fix #to_json for BasicObject EnumerablesSammy Larbi2014-03-142-2/+2
| | | | |