aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merge pull request #25570 from y-yagi/remove_useless_parameterEileen M. Uchitelle2016-08-151-3/+3
|\ | | | | remove useless parameter
| * remove useless parameteryuuji.yaginuma2016-06-291-4/+4
| |
* | let instance thread_mattr_* methods delegate to the class-level onesXavier Noria2016-08-081-4/+10
| | | | | | | | | | | | | | This code has too much duplication and the rationale for the concatenation may not be obvious to the reader. You define the ones at class-level, explain why does the code concatenates there, and then the convenience ones at instance-level just delegate.
* | Merge pull request #25681 from willnet/fix-thread_mattr_accessorYves Senn2016-08-081-4/+4
|\ \ | | | | | | | | | Fix `thread_mattr_accessor` share variable superclass with subclass
| * | Fix `thread_mattr_accessor` share variable superclass with subclasswillnet2016-08-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of `thread_mattr_accessor` set variable sharing superclass with subclass. So the method doesn't work as documented. Precondition class Account thread_mattr_accessor :user end class Customer < Account end Account.user = "DHH" Account.user #=> "DHH" Customer.user = "Rafael" Customer.user # => "Rafael" Documented behavior Account.user # => "DHH" Actual behavior Account.user # => "Rafael" Current implementation set variable statically likes `Thread[:attr_Account_user]`, and customer also use it. Make variable name dynamic to use own thread-local variable.
* | | damn typos [ci skip]Xavier Noria2016-08-081-1/+1
| | |
* | | explain why aliasing uses explicit selfs [ci skip]Xavier Noria2016-08-081-0/+3
| | |
* | | code gardening: removes redundant selfsXavier Noria2016-08-086-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* | | applies remaining conventions across the projectXavier Noria2016-08-064-16/+12
| | |
* | | normalizes indentation and whitespace across the projectXavier Noria2016-08-068-44/+43
| | |
* | | modernizes hash syntax in activesupportXavier Noria2016-08-068-65/+65
| | |
* | | applies new string literal convention in activesupport/libXavier Noria2016-08-0683-291/+291
|/ / | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | Revert "Adds `not_in?` onto Object"David Heinemeier Hansson2016-07-292-16/+0
| |
* | Merge pull request #25914 from jmccartie/jm/not_inRafael França2016-07-222-0/+16
|\ \ | | | | | | Adds `not_in?` onto Object
| * | Adds `not_in?` onto ObjectJon McCartie2016-07-212-0/+16
| | |
* | | systematic revision of =~ usage in ASXavier Noria2016-07-223-7/+10
| | | | | | | | | | | | | | | Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with?