aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* Adjust `Module.parent_name` to work when frozen; fixes #27637Corey Ward2017-01-171-2/+4
|
* All currently supported rubies already have LoadError#pathAkira Matsuda2017-01-171-12/+0
|
* :golf: else + if = elsifAkira Matsuda2017-01-171-10/+8
|
* Revert "Merge pull request #27686 from koic/friendly_bigdecimal_inspect"Kasper Timm Hansen2017-01-151-7/+0
| | | | | | | | | | | | | The exact inspect output of a BigDecimal is out of scope for what we're trying to communicate about `dup` and `duplicable?` here. Adding two examples distracts is disctracting, so keep the docs from before since our minimal version is Ruby 2.2.2. [ Koichi ITO, Jon Moss, Kasper Timm Hansen ] This reverts commit 2163874dedaf83e67599c2930c2686caa165fbad, reversing changes made to 46fdbc5290335ed38fa9fe2b6b0ef8abe4eccb1b.
* Several representation of BigDecimal has changed in Ruby 2.4.0+ [ci skip]Koichi ITO2017-01-151-0/+7
| | | | cf. https://github.com/ruby/bigdecimal/pull/42
* Add duration constructors for use in Numeric extensionsAndrew White2017-01-122-8/+8
| | | | | The Numeric extensions like 1.day, 1.month, etc. shouldn't know how the internals of ActiveSupport::Duration works.
* Fix inconsistent results when parsing large durations and constructing ↵Andrey Novikov2017-01-092-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | durations from code ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true Duration parsing made independent from any moment of time: Fixed length in seconds is assigned to each duration part during parsing. Changed duration of months and years in seconds to more accurate and logical: 1. The value of 365.2425 days in Gregorian year is more accurate as it accounts for every 400th non-leap year. 2. Month's length is bound to year's duration, which makes sensible comparisons like `12.months == 1.year` to be `true` and nonsensical ones like `30.days == 1.month` to be `false`. Calculations on times and dates with durations shouldn't be affected as duration's numeric value isn't used in calculations, only parts are used. Methods on `Numeric` like `2.days` now use these predefined durations to avoid duplicating of duration constants through the codebase and eliminate creation of intermediate durations.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-052-2/+2
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Fix style guide violationsRafael Mendonça França2017-01-051-1/+1
|
* Merge pull request #26480 from tbrisker/fix-26461Rafael França2017-01-041-2/+7
|\ | | | | Clarify that mattr_* creates public methods
| * Reword according to feedbackTomer Brisker2016-09-151-8/+7
| |
| * Clarify that mattr_* creates public methodsTomer Brisker2016-09-131-0/+6
| |
* | There's no such moduleAkira Matsuda2017-01-051-4/+4
| |
* | Remove unnecessary require statementsJon Moss2017-01-031-3/+0
| | | | | | | | Should have been removed via 8e43fc5ace8039370f233570863b34821a3be46f.
* | Merge pull request #27363 from amatsuda/refined_array_sumSean Griffin2017-01-031-2/+7
|\ \ | | | | | | Refining Array#sum monkey-patch using Refinements
| * | Refining Array#sum monkey-patch using RefinementsAkira Matsuda2016-12-151-2/+7
| | | | | | | | | | | | Because we don't want to see our ugly orig_sum method outside of this file
* | | Fix Symbol#duplicable? for Ruby 2.4.0.Kasper Timm Hansen2017-01-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby 2.4.0 has trouble duplicating certain symbols created from strings via `to_sym`. It didn't happen with `'symbol'.to_sym.dup` for some reason, but works fine with the longer string sample. Once a newer Ruby version with a fix is released we'll get have a failing test case we can fix. Ref: #27532
* | | Fix Complex and Rational are duplicable?utilum2016-12-211-0/+20
|/ / | | | | | | See [this test](https://gist.github.com/utilum/78918f1b64f8b61ee732cb266db7c43a).
* | change return value of `duplicable?` with Ruby 2.4+yuuji.yaginuma2016-12-131-33/+58
| | | | | | | | | | | | | | `NilClass`, `FalseClass`, `TrueClass`, `Symbol` and `Numeric` can dup with Ruby 2.4+. Ref: https://bugs.ruby-lang.org/issues/12979
* | split DELEGATION_RESERVED_METHOD_NAMES in halfToshimaru2016-12-091-4/+5
| |
* | Exclude singleton classes from `subclasses` and `descendants`Sean Griffin2016-12-011-0/+1
| | | | | | | | | | | | | | | | This behavior changed in Ruby starting with 2.3.0, as a result of https://bugs.ruby-lang.org/issues/11360. This results in a change in behavior of these methods which is likely undesirable. Fixes #27238
* | Merge pull request #27035 from rails/remove-active-support-deprecationsAndrew White2016-11-1411-151/+1
|\ \ | | | | | | Remove Active Support deprecations
| * | Remove deprecated separator argument from parameterizeAndrew White2016-11-141-5/+1
| | |
| * | Remove deprecated method Numeric#to_formatted_sAndrew White2016-11-141-5/+0
| | |
| * | Remove deprecated method alias_method_chainAndrew White2016-11-141-48/+0
| | |
| * | Remove deprecated constant MissingSourceFIleAndrew White2016-11-141-2/+0
| | |
| * | Remove deprecated Module.qualified_const_get/set/defined?Andrew White2016-11-142-71/+0
| | |
| * | Remove deprecated time marshal core_ext fileAndrew White2016-11-131-3/+0
| | |
| * | Remove deprecated struct core_ext fileAndrew White2016-11-131-3/+0
| | |
| * | Remove deprecated module method_transplanting fileAndrew White2016-11-131-3/+0
| | |
| * | Remove deprecated local_constantsAndrew White2016-11-131-8/+0
| | |
| * | Remove deprecated kernel debugger fileAndrew White2016-11-131-3/+0
| | |
* | | Revert "Merge pull request #25811 from oss92/to_sentence_fallback_string"Rafael Mendonça França2016-11-141-8/+2
|/ / | | | | | | | | | | | | | | This reverts commit bad3a120f1690f393d8f6204b3ceee60f0ce707b, reversing changes made to 2384317465ccb1dfca456a2b7798714b99f32711. Reason: Adding a new option in the API for something that can be done with a `#presence` check could do.
* | Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-135-6/+6
|\ \ | | | | | | Add missing `+` around a some literals.
| * | Add missing `+` around a some literals.bogdanvlviv2016-10-275-6/+6
| | | | | | | | | | | | | | | | | | Mainly around `nil` [ci skip]
* | | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-299-12/+12
|/ /
* | Use Hash#compact and Hash#compact! from Ruby 2.4Prathamesh Sonpatki2016-10-231-18/+22
| | | | | | | | | | | | - Ruby 2.4 has added Hash#compact and Hash#compact! so we can use it now. - Reference: https://bugs.ruby-lang.org/issues/11818 and https://bugs.ruby-lang.org/issues/12863.
* | Merge pull request #26839 from renuo/fix-missing-nsec-transferAndrew White2016-10-211-1/+1
|\ \ | | | | | | Fix copy_time_to: Copy nsec instead of usec
| * | Fix copy_time_to: Copy nsec instead of usecJosua Schmid2016-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `copy_time_to` is a helper function for date and time calculations. It's being used by `prev_week`, `next_week` and `prev_weekday` to keep the time fraction when jumping around between days. Previously the nanoseconds part was lost during the operation. This lead to problems in practice if you were using the `end_of_day` calculation. Resulting in the time fraction of `end_of_day` not being the same as next week's `end_of_day`. With this fix `copy_time_to` doesn't forget the `nsec` digits.
* | | doc, hide non-public methods form the api docs. [ci skip]Yves Senn2016-10-201-2/+2
|/ / | | | | | | | | | | | | | | | | This is a follow up to #25681, specifically this comment: https://github.com/rails/rails/pull/25681#issuecomment-238294002 The way the thread local variable is stored is an implementation detail and subject to change. It makes no sense to only generate a reader or writer as you'd have to know where to read from or where it writes to.
* | Add comment to remove code when we are in Ruby 2.4Rafael Mendonça França2016-10-141-0/+1
| |
* | Use built-in #transform_values when available.Jesús Burgos2016-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The methods Hash#transform_values and Hash#transform_values! have been implemented in Ruby and they'll be available as part of the standard library. Here's the link to the discussion in Ruby's issue tracker: https://bugs.ruby-lang.org/issues/12512 These methods are implemented in C so they're expected to perform better.
* | Fixnum and Bignum are deprecated in Ruby trunkMatthew Draper2016-10-081-1/+1
| | | | | | | | https://bugs.ruby-lang.org/issues/12739
* | Cache to_time to improve performance when comparingAndrew White2016-10-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #25880 we tried to cache localtime to fix the performance regression but that proved to be difficult due to the fact that localtime/getlocal can take a utc_offset argument. We tried caching based on the argument but since the argument can be nil sometimes that meant that if the TZ environment variable changed then the cached value for nil became invalid. By moving the caching to DateAndTime#compatibility we don't have to worry about arguments since it doesn't take any. There is a possible edge condition where preserve_timezone is set to false and the system timezone changes then it could result in a cached value being incorrect but the only way to fix this would be to remove all caching and live with the performance issue.
* | [ci skip] Remove not necessary whitespaceAndrey Molchanov2016-09-281-1/+1
| |
* | fix typo in `DateAndTime::Calculations#all_week` doc [ci skip]yuuji.yaginuma2016-09-271-1/+1
| | | | | | | | | | `Date.week_start` does not exist. `Date.beginning_of_week` seems to be correct. Ref: #5339
* | Prevent circular require of proxy_wrappers.rb, Fixes #26430Wolfgang Teuber2016-09-211-0/+1
|/
* change `Class#descendants` to public API [ci skip]yuuji.yaginuma2016-09-051-2/+15
| | | | | | `Class#descendants` has already been displayed in Rails guide, so I think that may be displayed in doc. http://guides.rubyonrails.org/active_support_core_extensions.html#descendants
* Fix typo in Delegation#delegate_missing_to doc [skip ci]Anton Davydov2016-08-271-1/+1
|
* Add three new rubocop rulesRafael Mendonça França2016-08-164-10/+10
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.