aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* Delegation works with reserved words passed to `:to`Agis-2014-09-191-1/+9
| | | | Fixes #16956.
* [ci skip] ActiveSupport CHANGELOG fixesAkshay Vishnoi2014-09-181-0/+1
| | | | | | | 1. spacing issues 2. spelling correction 3. grammar correction 4. Add missing docs
* As of Unicode 6.3, Mongolian Vowel Separator is not whitespaceMatthew Draper2014-09-151-1/+1
| | | | | Ruby 2.2 knows this, and no longer matches it with [[:space:]], so it's not a good candidate for testing String#squish.
* Time#change can now change nanoseconds (:nsec)Agis-2014-09-141-6/+13
| | | | Closes #16392.
* Time#change throws exception with an out-of-range :usecAgis-2014-09-041-0/+1
| | | | | | | | | | https://github.com/rails/rails/commit/98b46bf5e201307cae56ee14bf41363a539779c5 did not properly handled out-of-range `:usec`s. Passing a `:usec` that's out of range now throws an `ArgumentError` as it should. Fixes #16759.
* Methods are not duplicable.Peter Jaros2014-09-031-0/+10
|
* We tenderized the wrong method! Object#try already had the yield option, ↵David Heinemeier Hansson2014-08-292-15/+12
| | | | just needed some tenderloving instance_eval to fit the bill
* Use instance_eval on @tenderlove's suggestion :trollface:David Heinemeier Hansson2014-08-291-4/+5
|
* Update examples to show real worthDavid Heinemeier Hansson2014-08-291-1/+1
|
* Added yield to Object#presenceDavid Heinemeier Hansson2014-08-291-1/+12
|
* Add documentation intro to example for `Object#itself`.Zachary Scott2014-08-191-2/+5
| | | | | Also moved comment for removal above `unless()` to not confuse RDoc with the documentation for this method.
* 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
|/ /