aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* 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?
* | | adds require for Regexp#match?Xavier Noria2016-07-221-0/+2
| | |
* | | revises styleXavier Noria2016-07-221-1/+1
|/ /
* | performance boost for String#blank? in Ruby 2.4Xavier Noria2016-07-221-1/+1
| | | | | | | | | | | | Some casual benchmarks showed a 2x factor. All credit goes to @nurse.
* | define Range#match? if Ruby < 2.4Xavier Noria2016-07-221-0/+4
| | | | | | | | | | | | See the rationale in the documentation included in this patch. We are going to gradually introduce this predicate in the code base.
* | Added :fallback_string option to Array#to_sentenceoss922016-07-131-2/+8
| |
* | Missing require 'active_support/multibyte/unicode'Akira Matsuda2016-07-121-0/+1
| |
* | Update class_attribute docsJohn Gesimondo2016-07-101-1/+1
|/
* Define `Pathname#as_json`Ryunosuke Sato2016-06-251-0/+7
| | | | | | | | | | | | | | | | | When the Pathname object is converted as JSON, it should be a string that means itself. Expected: ``` >> Pathname.new('/path/to/somewhere.txt').as_json "/path/to/somewhere.txt" ``` Actual: ``` >> Pathname.new('/path/to/somewhere.txt').as_json {"path"=>"/path/to/somewhere.txt"} ```
* Define `URI::Generic#as_json`Ryunosuke Sato2016-06-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the URI object is converted as JSON, it is expected that it is a string that means its URI. Expected: ``` >> URI.parse('http://example.com').as_json "http://example.com" ``` Actual: ``` >> URI.parse('http://example.com').as_json {"scheme"=>"http", "user"=>nil, "password"=>nil, "host"=>"example.com", "port"=>80, "path"=>"", "query"=>nil, "opaque"=>nil, "fragment"=>nil, "parser"=> {"regexp"=> {"SCHEME"=>"(?-mix:\\A[A-Za-z][A-Za-z0-9+\\-.]*\\z)", "USERINFO"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=A-Z_a-z~])*\\z)", "HOST"=> "(?-mix:\\A(?:(?<IP-literal>\\[(?:(?<IPv6address>(?:\\h{1,4}:){6}(?<ls32>\\h{1,4}:\\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5]|\\d)\\.\\g<dec-octet>\\.\\g<dec-octet>\\.\\g<dec-octet>))|::(?:\\h{1,4}:){5}\\g<ls32>|\\h{,4}::(?:\\h{1,4}:){4}\\g<ls32>|(?:(?:\\h{1,4}:)?\\h{1,4})?::(?:\\h{1,4}:){3}\\g<ls32>|(?:(?:\\h{1,4}:){,2}\\h{1,4})?::(?:\\h{1,4}:){2}\\g<ls32>|(?:(?:\\h{1,4}:){,3}\\h{1,4})?::\\h{1,4}:\\g<ls32>|(?:(?:\\h{1,4}:){,4}\\h{1,4})?::\\g<ls32>|(?:(?:\\h{1,4}:){,5}\\h{1,4})?::\\h{1,4}|(?:(?:\\h{1,4}:){,6}\\h{1,4})?::)|(?<IPvFuture>v\\h+\\.[!$&-.0-;=A-Z_a-z~]+))\\])|\\g<IPv4address>|(?<reg-name>(?:%\\h\\h|[!$&-.0-9;=A-Z_a-z~])*))\\z)", "ABS_PATH"=> "(?-mix:\\A\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*(?:\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*)*\\z)", "REL_PATH"=> "(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])+(?:\\/(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~])*)*\\z)", "QUERY"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~\\/?])*\\z)", "FRAGMENT"=>"(?-mix:\\A(?:%\\h\\h|[!$&-.0-;=@-Z_a-z~\\/?])*\\z)", "OPAQUE"=>"(?-mix:\\A(?:[^\\/].*)?\\z)", "PORT"=> "(?-mix:\\A[\\x09\\x0a\\x0c\\x0d ]*\\d*[\\x09\\x0a\\x0c\\x0d ]*\\z)"}}} ```
* Replace Kernel#caller by the faster Kernel#caller_locationsJean Boussier2016-06-101-2/+2
|
* Merge pull request #25265 from opti/improve/hash_compactKasper Timm Hansen2016-06-071-5/+8
|\ | | | | Improve Hash#compact! documentation and tests