aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge branch 'master' into make-reverse-merge-bang-order-consistentSean Griffin2017-07-17114-311/+633
|\ \ \
| * | | [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-11114-0/+114
| |/ /
| * | Merge pull request #29728 from kirs/frozen-activesupportMatthew Draper2017-07-09114-0/+114
| |\ \ | | | | | | | | Use frozen-string-literal in ActiveSupport
| | * | Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-09114-0/+114
| | |/
| * / Use `map` in `delegate` so that actual prefixed method names are returned, ↵Krzysztof Zych2017-07-051-1/+1
| |/ | | | | | | if using prefix version.
| * [Active Support] require => require_relativeAkira Matsuda2017-07-0159-187/+187
| |
| * Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-1/+1
| |
| * Implement mattr_acessor :default optionGenadi Samokovarov2017-06-031-24/+19
| |
| * Add next occur and previous occurred day of week API (#26600)Shota Iguchi2017-05-301-0/+16
| |
| * Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
| * Assorted delegate_missing_to doc fixesT.J. Schuck2017-05-041-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | * Fix rdoc code formatting — `tt`, not backticks * Fix/simplify sentence grammar — should at least just be “and the like”, not “likes”, but this is just general tightening up. * Add note that delegated methods must be public. Tested here: https://github.com/rails/rails/blob/7ff5ccae94ce2aff76b5f8a31a28e305a047d642/activesupport/test/core_ext/module_test.rb#L359-L365 * Simplify example code for delegate_missing_to. The example had complexity that wasn’t necessary for demonstrating `delegate_missing_to`. This gets rid of a bunch of cruft so the example is more obvious about what’s going on regarding the feature itself. [ci skip]
| * Add missing require for `remove_possible_method`Eugene Kenny2017-04-281-0/+1
| | | | | | | | | | | | https://github.com/rails/rails/commit/505537082849d912e8e29819655b80a573e93c0c added a call to `remove_possible_method`, but didn't require the file that defines it.
| * Add commaJon Moss2017-04-201-1/+1
| | | | | | | | [ci skip]
| * Fix Enumerable#sum redefined warningFumiaki MATSUSHIMA2017-04-181-23/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we require 'active_support/core_ext/enumerable' on Ruby 2.4, we'll see following warning because `Enumerable#sum` and `Array#sum` are added in Ruby 2.4. ``` rails/rails/activesupport/lib/active_support/core_ext/enumerable.rb:20: warning: method redefined; discarding old sum ``` The minimal way to fix the warning is `alias sum sum`. ``` $ ruby -v ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] $ ruby -w -e "def a; end; def a; end" -e:1: warning: method redefined; discarding old a -e:1: warning: previous definition of a was here $ ruby -w -e "def a; end; alias a a; def a; end" ``` But this behavior is not intended. (@amatsuda was told by @ko1) So we should use `alias` as a meaningful way. Ruby 2.4's `sum` (`orig_sum`) assumes an `identity` is `0` when we omit `identity` so we can delegate to `orig_sum` with explicit `identity` only. In a strict sense, we can detect `identity` by check instance's class but we don't care at this time about that because calling `Enumerable#sum` is rare. In many cases, we will call `Array#sum`.
| * Add missing periodsJon Moss2017-04-171-2/+2
| | | | | | | | [ci skip]
| * Add (more) documentation to to_timeKen Mayer2017-04-171-0/+3
| | | | | | | | | | There's a difference in the results between `Date#to_time(:local)` and `Date#in_time_zone` but it is subtle and can confuse users (like me :-).
| * Merge pull request #28638 from bogdanvlviv/prepend_and_append_in_rubyKasper Timm Hansen2017-04-151-2/+2
| |\ | | | | | | Prevent aliases Array#append and Array#prepend
| | * Prevent aliases Array#append and Array#prependbogdanvlviv2017-04-021-2/+2
| | | | | | | | | | | | https://github.com/ruby/ruby/commit/f57d515d69b7a35477b9ba5d08fe117df1f1e275
| * | Add additional options to time `change` methodsAndrew White2017-04-141-15/+21
| | | | | | | | | | | | | | | | | | | | | Support `:offset` in `Time#change` and `:zone` or `:offset` in `ActiveSupport::TimeWithZone#change`. Fixes #28723.
| * | delegate_missing_to should fall back to superMatthew Draper2017-04-091-1/+1
| | |
| * | delegate_to_missing doesn't delegate private methodsMatthew Draper2017-04-091-1/+4
| |/ | | | | | | So we shouldn't claim they're there, even when asked explicitly.
| * Add aliases for reverse_merge to with_defaultsMatt Casper2017-03-291-0/+2
| | | | | | | | | | | | In the context of controller parameters, reverse_merge is commonly used to provide defaults for user input. Having an alias to reverse_merge called with_defaults feels more idiomatic for Rails.
| * Use keyword arguments instead of hashRafael Mendonça França2017-03-281-4/+4
| |
| * Merge pull request #28480 from ↵Rafael Mendonça França2017-03-281-9/+19
| |\ | | | | | | | | | | | | | | | mubashirhanif/add_keep_id_suffix_option_to_humanize_new Add keep id suffix option to humanize new
| | * Added options hash to titleize method and keep_id_suffix option to humanizeMubashir Hanif2017-03-211-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | some documentation remove extra whitespace. Added id in the middle test case and corrected some testcases. Some Coding standard guidelines corrections as suggested by codeclimate. Some more corrections suggested by codeclimate.
| * | Fix doc format for `duplicable?` [ci skip]yuuji.yaginuma2017-03-251-6/+6
| | |
| * | Remove unnecessary ruby version comments [ci skip]Vipul A M2017-03-241-2/+2
| | |
| * | Fix duplicable? for Ratiional and Complex on ruby master, since they are now ↵Vipul A M2017-03-231-12/+22
| | | | | | | | | | | | duplicable
| * | Cleanup documentation fixes (#28460)Vipul A M2017-03-171-2/+2
| | |
| * | Merge pull request #28445 from denniszelada/feature-documentation-with_optionsVipul A M2017-03-171-0/+11
| |\ \ | | | | | | | | Add documentation to use with_options anywhere in the same class [ci
| | * | Add documentation to use with_options in the same class [ci skip]Dennis Zelada2017-03-161-0/+11
| | | |
| * | | Move `to_time` to `DateTime` compatibility.rb fileAndrew White2017-03-163-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | We are overriding it in `Time` and `ActiveSupport::TimeWithZone` so there's no point in having it in the `DateAndTime::Compatibility` module. Also add some docs for the `to_time` implementations.
| * | | Merge pull request #28147 from kmcphillips/master-time-freezeAndrew White2017-03-162-6/+9
| |\ \ \ | | | | | | | | | | Allow Time#to_time on frozen objects. Return frozen time rather than "RuntimeError: can't modify frozen Time"
| | * | | Handle #to_time and memoization taking into account memoization, frozen ↵Kevin McPhillips2017-03-062-6/+9
| | |/ / | | | | | | | | | | | | state, and preserve_timezone flag.
* | / / Make the order of Hash#reverse_merge! consistent with HashWithIndifferentAccessErol Fornoles2017-03-061-2/+1
|/ / /
* | | Add `rfc3339` aliases to `xmlschema`Andrew White2017-03-031-0/+3
| | | | | | | | | | | | | | | For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
* | | Add `Time.rfc3339` parsing methodAndrew White2017-03-031-0/+23
| | | | | | | | | | | | | | | | | | | | | The `Time.xmlschema` and consequently its alias `iso8601` accepts timestamps without a offset in contravention of the RFC 3339 standard. This method enforces that constraint and raises an `ArgumentError` if it doesn't.
* | | Update `DateTime#change` to support usec and nsecAndrew White2017-03-021-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding support for these options now allows us to update the `DateTime#end_of` methods to match the equivalent `Time#end_of` methods, e.g: datetime = DateTime.now.end_of_day datetime.nsec == 999999999 # => true Fixes #21424.
* | | add optional second argument to ActiveSupport core extension for ↵Jeff Latz2017-02-241-2/+2
|/ / | | | | | | Marshal#load so it can take a proc
* | Not ants were harmed! 🐜Mario Uher2017-02-141-1/+1
| |
* | Docs: Correction: Module::DelegationErrorJared Beck2017-02-031-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the delegation target is nil and the allow_nil option is not in use, a Module::DelegationError is raised. class C delegate :a, to: :b def b nil end end C.new.a # => Module::DelegationError: C#a delegated to b.a, but b is nil [ci skip]
* | add missing comment out [ci skip]bogdanvlviv2017-01-201-1/+1
| |
* | add missing comment out [ci skip]yuuji.yaginuma2017-01-201-7/+7
| |
* | Allocation free Integer#to_sJean Boussier2017-01-191-16/+15
| |
* | 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.