aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* Fix DateTime comparison with DateTime::Infinity objectRafael Mendonça França2014-08-061-1/+3
| | | | Fixes #16406
* Fix AS docs / changelog with wrong method [ci skip]Carlos Antonio da Silva2014-08-051-1/+1
|
* Update itself.rb [ci skip]Jon Atack2014-08-051-1/+1
|
* Only define Objetc#itself when it is not definedRafael Mendonça França2014-08-041-8/+10
| | | | | | | Ruby 2.2 will include Kernel#itself so we don't need to define again. See https://github.com/ruby/ruby/commit/0a0160d6b659f6131a525fe1579e7c463d4c197e
* Rename Object#self to Object#itself to have parity with matz sanctioned ↵David Heinemeier Hansson2014-08-012-3/+3
| | | | method name for Ruby 2.2
* Added Object#self which returns the object itselfDavid Heinemeier Hansson2014-08-012-0/+11
|
* Raise a descriptive error if non-positive integer passed to in_groups_of.Xavier Shay2014-07-301-0/+5
| | | | | | | | | | This is more consistent than the current behaviour of raising a `ZeroDivisionError: divided by 0` error when 0 is given, which can be non-obvious especially if `in_groups_of` is part of a longer chain of methods. The negative case was ok - "ArgumentError: invalid slice size" - but this error is clearer still.
* Add implicit receiver support to `Object#with_options`Pavel Pravosud2014-07-291-2/+15
|
* Fixed a compatibility issue with the `Oj` gemGodfrey Chan2014-07-291-3/+3
| | | | | | | | | | | | | `Time#as_json`, `Date#as_json` and `DateTime#as_json` incorrectly depends on a delegation that is set up in `active_support/json/encoding`. We cannot simply require that file in `core_ext/object/json` because it would cause a circular dependency problem (see #12203 for background). We should instead rely on AS's autoload to load that file for us on-demand. To trigger autoload correctly, we need to reference the `AS::JSON::Encoding` constant instead of using the delegated version. Fixes #16131.
* Merge pull request #15629 from akshay-vishnoi/test-to_paramRafael Mendonça França2014-07-282-66/+59
|\ | | | | Define Hash#to_query and set Hash#to_param as alias to it; with test cases
| * Move to_param to to_query, also Improve testsAkshay Vishnoi2014-06-202-66/+59
| |
* | Merge pull request #16190 from oss92/word_truncationMatthew Draper2014-07-171-0/+24
|\ \ | | | | | | | | | Word truncation
| * | Added truncate_words method to activesupport stringsroot2014-07-161-0/+21
|/ /
* | Move uuid_v5 and uuid_v3 to Digest::UUIDRafael Mendonça França2014-07-152-47/+51
| | | | | | | | | | These methods are not random so they should not belings to SecureRandom module.
* | Deprecate reporting methods for silencing output as they aren't thread safeTom Meier2014-07-151-0/+10
| |
* | Return an Enumerator if no block is givenErik Michaels-Ober2014-07-122-1/+5
| |
* | Don't construct a Proc if no block is givenErik Michaels-Ober2014-07-121-1/+1
| |
* | The hex escape sequence can be of any lengthGodfrey Chan2014-07-021-1/+1
| |
* | Fix escape_once double-escaping hex-encoded entitiesJohn F. Douthat2014-07-021-1/+1
| | | | | | | | (This is a manual merge of #9102)
* | `DateTime#to_f` now preserves fractional seconds.John Paul Ashenfelter2014-07-021-2/+2
| | | | | | | | | | | | | | Previously this method always returns `.0` in the fractional part. This commit changes it to preserve the fractional seconds instead. Fixes #15994.
* | Add `Hash#map_values` to ActiveSupportSean Griffin2014-06-292-0/+22
| | | | | | | | | | Didn't get a chance to convert existing code, I'll skim through the code base to make use of this later this afternoon.
* | :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.