aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | | Merge pull request #20944 from repinel/fix-time-with-zone-eqlKasper Timm Hansen2015-07-191-1/+1
| |\ \ \ \ \ \ \ \ \ | | |/ / / / / / / / | |/| | | | | | | | Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`
| | * | | | | | | | Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`Roque Pinel2015-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => false ``` Now: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => true ``` Please notice that this fix the `TimeWithZone` comparison to itself, not to `DateTime`. Based on #3725, `DateTime` should not be equal to `TimeWithZone`.
| * | | | | | | | | Merge pull request #20839 from ↵Sean Griffin2015-07-181-9/+34
| |\ \ \ \ \ \ \ \ \ | | |/ / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | TheBlasfem/added_examples_dateandtime_calculations Added examples to DateAndTime::Calculations [ci skip]
| | * | | | | | | | added examples to DateAndTime::Calculations [ci skip]Julio Lopez2015-07-181-9/+34
| | | | | | | | | |
| * | | | | | | | | ActiveSupport::HashWithIndifferentAccess select and reject should return ↵Bernard Potocki2015-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enumerator if called without block
| * | | | | | | | | [skip ci] Lookup can be a noun but it is not a verbJon Atack2015-07-171-1/+2
| | |_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | Various grammar corrections and wrap to 80 characters.
| * | | | | | | | Merge pull request #20887 from tgxworld/ar_callbacksRafael Mendonça França2015-07-151-3/+11
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Revert "Revert "Reduce allocations when running AR callbacks.""
| | * | | | | | | | Revert "Revert "Reduce allocations when running AR callbacks.""Guo Xiang Tan2015-07-161-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bdc1d329d4eea823d07cf010064bd19c07099ff3. Before: Calculating ------------------------------------- 22.000 i/100ms ------------------------------------------------- 229.700 (± 0.4%) i/s - 1.166k Total Allocated Object: 9939 After: Calculating ------------------------------------- 24.000 i/100ms ------------------------------------------------- 246.443 (± 0.8%) i/s - 1.248k Total Allocated Object: 7939 ``` begin require 'bundler/inline' rescue LoadError => e $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' raise e end gemfile(true) do source 'https://rubygems.org' # gem 'rails', github: 'rails/rails', ref: 'bdc1d329d4eea823d07cf010064bd19c07099ff3' gem 'rails', github: 'rails/rails', ref: 'd2876141d08341ec67cf6a11a073d1acfb920de7' gem 'arel', github: 'rails/arel' gem 'sqlite3' gem 'benchmark-ips' end require 'active_record' require 'benchmark/ips' ActiveRecord::Base.establish_connection('sqlite3::memory:') ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users, force: true do |t| t.string :name, :email t.boolean :admin t.timestamps null: false end end class User < ActiveRecord::Base default_scope { where(admin: true) } end admin = true 1000.times do attributes = { name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", email: "foobar@email.com", admin: admin } User.create!(attributes) admin = !admin end GC.disable Benchmark.ips(5, 3) do |x| x.report { User.all.to_a } end key = if RUBY_VERSION < '2.2' :total_allocated_object else :total_allocated_objects end before = GC.stat[key] User.all.to_a after = GC.stat[key] puts "Total Allocated Object: #{after - before}" ```
| * | | | | | | | | Replaced `ActiveSupport::Concurrency::Latch` with concurrent-ruby.Jerry D'Antonio2015-07-131-16/+8
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
* / / / / / / / / [ci skip] Add missing `super` to the setup of the ↵Lucas Mazza2015-08-141-0/+1
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | `ActiveSupport::LogSubscriber::TestHelper` example.
* | | | | | | | Merge pull request #20838 from TheBlasfem/improve_duplicable_documentationKasper Timm Hansen2015-07-111-1/+5
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Improve duplicable documentation [ci skip]
| * | | | | | | | improve duplicable documentation [ci skip]Julio Lopez2015-07-101-1/+5
| |/ / / / / / /
* | | | | | | | Merge pull request #17102 from matthewd/load-interlockAaron Patterson2015-07-103-34/+243
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Concurrent load interlock (rm Rack::Lock)
| * | | | | | | | Document ShareLock and the InterlockMatthew Draper2015-07-093-9/+42
| | | | | | | | |
| * | | | | | | | Rely on the load interlock for non-caching reloads, tooMatthew Draper2015-07-091-0/+10
| | | | | | | | |
| * | | | | | | | Soften the lock requirements when eager_load is disabledMatthew Draper2015-07-093-34/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
* | | | | | | | | Add multiple expected calls to assert_called_with.Kasper Timm Hansen2015-07-101-1/+6
| | | | | | | | |
* | | | | | | | | Merge pull request #20828 from Sirupsen/hash-indifferent-dup-default-procRafael Mendonça França2015-07-101-2/+12
|\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / |/| | | | | | | | active_support/indifferent_access: fix not raising when default_proc does
| * | | | | | | | active_support/indifferent_hash: dont raise on to_hash when default_proc raisesSimon Eskildsen2015-07-101-1/+3
| | | | | | | | |
| * | | | | | | | active_support/indifferent_hash: fix cloning default_proc on dupSimon Eskildsen2015-07-101-1/+9
| | |_|_|_|_|_|/ | |/| | | | | |
* | | | | | | | Merge pull request #20784 from kaspth/great-expectationsKasper Timm Hansen2015-07-081-0/+30
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | Add method call assertions for internal use.
| * | | | | | | Add method call assertions for internal use.Kasper Timm Hansen2015-07-081-0/+30
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add `assert_called` and `assert_not_called` to boil down the boilerplate we need to write to assert methods are called certain number of times.
* | | | | | | adding brackets to array in docsJulio Lopez2015-07-071-1/+1
| | | | | | |
* | | | | | | Add to RDoc of OrderedOptions the bang infoMauro George2015-07-061-0/+8
|/ / / / / / | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | Merge pull request #20575 from prathamesh-sonpatki/doc-xml-disallowed-typesZachary Scott2015-06-181-1/+19
|\ \ \ \ \ \ | | | | | | | | | | | | | | Added documentation about passing custom disallowed types to Hash#from_xml [ci skip]
| * | | | | | Added documentation about passing custom disallowed types to Hash#from_xml ↵Prathamesh Sonpatki2015-06-181-1/+19
| |/ / / / / | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | enforce a depth limit on XML documentsAaron Patterson2015-06-163-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XML documents that are too deep can cause an stack overflow, which in turn will cause a potential DoS attack. CVE-2015-3227
* | | | | | Escape HTML entities in JSON keysRafael Mendonça França2015-06-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Fixes CVE-2015-3226
* | | | | | Fix the message verifier encoding issueRoque Pinel2015-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```ruby verifier = ActiveSupport::MessageVerifier.new('secret') verifier.verify("\xff") # => ArgumentError: invalid byte sequence in UTF-8 ```
* | | | | | Merge pull request #18365 from pocke/fix_datatime_compareAaron Patterson2015-06-121-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | DateTime#<=> return nil when compare to the invalid String as Time.
| * | | | | | DateTime#<=> return nil when compare to the invalid String as Time.pocke2015-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | before: p Time.now == 'a' # => false p Time.now <=> 'a' # => nil require 'active_support' require 'active_support/core_ext' p Time.now == 'a' # => false p Time.now <=> 'a' # => invalid date (ArgumentError) and on ruby 2.2, Time.now == 'a' warning. warning: Comparable#== will no more rescue exceptions of #<=> in the next release. warning: Return nil in #<=> if the comparison is inappropriate or avoid such comparison. after: - Error handling. - Quiet warnings.
* | | | | | | Merge pull request #20494 from ↵Rafael Mendonça França2015-06-121-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | knovoselic/active_support_concern_class_methods_fix [ActiveSupport] Fix for #20489 - ActiveSupport::Concern#class_methods affects parent classes
| * | | | | | | Fix for #20489 - ActiveSupport::Concern#class_methods affects parent classesKristijan Novoselic2015-06-121-1/+1
| | | | | | | |
* | | | | | | | inline test runner check into `as/testing/autorun.rb`.Yves Senn2015-06-111-1/+8
| |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible to easily get the runner working with existing setups that rely on `active_support/testing/autorun.rb`.
* | | | | | | Use block variable instead of globalRoque Pinel2015-06-091-1/+1
|/ / / / / /
* | | / / / Use block variable instead of globalRoque Pinel2015-06-081-1/+1
| |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```ruby Benchmark.ips do |x| x.report("$&") { "foo".gsub(/f/) { $&.hex } } x.report("block var") { "foo".gsub(/f/) { |match| match.hex } } end ``` ``` Calculating ------------------------------------- $& 23.271k i/100ms block var 24.804k i/100ms ------------------------------------------------- $& 321.981k (± 7.4%) i/s - 1.606M block var 324.949k (± 9.2%) i/s - 1.612M ```
* | | | | Merge pull request #19571 from kaspth/improve-runner-integrationYves Senn2015-06-082-0/+64
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Improve Test Runner's Minitest integration.
| * | | | | Improve test runner's Minitest integration.Kasper Timm Hansen2015-06-042-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also adds free mix and matching of directories, files and lines filters. Like so: bin/rails test models/post_test.rb test/integration models/person_test.rb:26 You can also mix in a traditional Minitest filter: bin/rails test test/integration -n /check_it_out/
* | | | | | A few documentation tweaks [ci skip]Robin Dupret2015-06-073-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | [Robin Dupret & Shunsuke Aida]
* | | | | | Merge pull request #20443 from teoljungberg/thoughtbot-capitalizationKasper Timm Hansen2015-06-051-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] Fix `thoughtbot` capitalization
| * | | | | | Fix `thoughtbot` capitalizationTeo Ljungberg2015-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The company name is spelled `thoughtbot` per https://github.com/thoughtbot/presskit/blob/master/README.md#name
* | | | | | | Require active_support/duration.Jimmy Cuadra2015-06-041-0/+1
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport::TimeWithZone references `ActiveSupport::Duration` but does not require it, which can result in a `LoadError` when required directly without requiring a component less granular like `active_support/time`, where the autoload for `ActiveSupport::Duration` is set up.
* | | | | | Merge pull request #20410 from schneems/schneems/boo-global-varsRafael Mendonça França2015-06-011-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Use block variable instead of global
| * | | | | | Use block variable instead of globalschneems2015-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```ruby require 'benchmark/ips' Benchmark.ips do |x| x.report("$&") { "foo".sub(/f/) { $&.upcase } } x.report("block var") { "foo".sub(/f/) {|match| match.upcase } } end ``` ``` Calculating ------------------------------------- $& 48.658k i/100ms block var 49.666k i/100ms ------------------------------------------------- $& 873.156k (± 9.3%) i/s - 4.331M block var 969.744k (± 9.2%) i/s - 4.818M ``` It's faster, and gets rid of a few "magic" global variables
* | | | | | | Merge pull request #20362 from kddeisz/enumerable_pluckRafael Mendonça França2015-06-011-2/+9
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Allow Enumerable#pluck to take a splat.
| * | | | | | | Allow Enumerable#pluck to take a splat.Kevin Deisz2015-05-291-2/+9
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows easier integration with ActiveRecord, such that AR#pluck will now use Enumerable#pluck if the relation is loaded, without needing to hit the database.
* | | | | | | Merge pull request #20138 from tgxworld/deprecated_assert_templateRafael Mendonça França2015-06-011-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Deprecate `assert_template` and `assigns()`.
| * | | | | | | Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-1/+1
| | |/ / / / / | |/| | | | |
* / | | | | | Fix a range of values for parameters of the Time#changeNikolay Kondratyev2015-06-011-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Passing 999999000 < `:nsec` < 999999999 and 999999 < `:usec` < 1000000 to change a time with utc_offset doesn't throw an `ArgumentError`.
* / / / / / Revert "Replace use of alias chains with prepend at core_ext/date and ↵Roque Pinel2015-05-295-79/+89
|/ / / / / | | | | | | | | | | | | | | | core_ext/time"