aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | 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.
* | 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.