aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object
Commit message (Collapse)AuthorAgeFilesLines
* Mark some constants as nodoc and remove unneeded namespaceRafael Mendonça França2015-03-201-11/+9
|
* Use Module#prepend instead of alias_method_chainKir Shatrov2015-03-201-12/+16
| | | | | | | Thanks @fbernier for suggestion! <3 At this moment we can use Module#prepend in all all cases except of Range because of the bug [1] in MRI 2.2 [1] https://bugs.ruby-lang.org/issues/10847
* Remove some comments about Ruby 1.9 behaviorsRafael Mendonça França2015-01-041-1/+1
|
* Remove hack to support BigDecimal in Ruby 1.9claudiob2015-01-041-11/+2
| | | | | Now that Rails requires Ruby >= 2.0, there is no need to check whether `BigDecimal` exists or not.
* Fix a few typos [ci skip]Robin Dupret2015-01-031-1/+1
|
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-01-031-3/+9
|\
| * Add docs for `Object.nil!`claudiob2014-12-221-3/+9
| | | | | | | | | | | | Also add doc examples for `Object.nil`. [ci skip]
* | Removed Object#itself as it's implemented in ruby 2.2Cristian Bica2014-12-291-15/+0
|/
* Replace `#=>` with `# =>` [ci skip]claudiob2014-12-171-2/+2
| | | | | | | | @rafaelfranca suggested in f7c7bcd9 that code examples should display the result after `# =>` and not after `#=>`. This commit replaces *all* the occurrences of `#=>` in the code documentation (mostly added by me :sob:) with the suggested `# =>`.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-293-3/+3
|
* Revert a change made to the example in 1ac4525Godfrey Chan2014-10-241-1/+1
| | | | | | | @carlosantoniodasilva pointed out that when `@person` is nil then this would blow up when you ended up calling `#first`on `nil`. > "there’s no way to break a try chain when you enter it :D" [ci skip]
* Include return value in examples added in #17378 [ci skip]Zachary Scott2014-10-241-2/+2
|
* Improved try documentation [ci skip]Eugene Gilburg2014-10-241-8/+25
| | | | | | | | | | - better `if` example - Added chaining example to the try method description - Documented the `respond_to?` check to the try method description - Clearer wording to explain that argument error is raised on argument mismatch to responding method, rather than to non-responding method (which is handled without exception by `try`) - `.any?` is more precise than `! .blank?` - Don't need to use `try` on `children` as (for regular associations) they will always be a collection or array that responds to `first` - Fix typos/grammar
* DRY up try/try!Ari Pollak2014-10-231-10/+6
|
* Bring try! into parity with try.Ari Pollak2014-10-221-1/+1
| | | | Based on commit 5e51bdda.
* [ci skip] Add Doc of with_options for the case when inherited default ↵Pramod Sharma2014-10-181-1/+15
| | | | options and original options have same keys
* Methods are not duplicable.Peter Jaros2014-09-031-0/+10
|
* We tenderized the wrong method! Object#try already had the yield option, ↵David Heinemeier Hansson2014-08-292-15/+12
| | | | just needed some tenderloving instance_eval to fit the bill
* Use instance_eval on @tenderlove's suggestion :trollface:David Heinemeier Hansson2014-08-291-4/+5
|
* Update examples to show real worthDavid Heinemeier Hansson2014-08-291-1/+1
|
* Added yield to Object#presenceDavid Heinemeier Hansson2014-08-291-1/+12
|
* Add documentation intro to example for `Object#itself`.Zachary Scott2014-08-191-2/+5
| | | | | Also moved comment for removal above `unless()` to not confuse RDoc with the documentation for this method.
* Fix AS docs / changelog with wrong method [ci skip]Carlos Antonio da Silva2014-08-051-1/+1
|
* Update itself.rb [ci skip]Jon Atack2014-08-051-1/+1
|
* Only define Objetc#itself when it is not definedRafael Mendonça França2014-08-041-8/+10
| | | | | | | Ruby 2.2 will include Kernel#itself so we don't need to define again. See https://github.com/ruby/ruby/commit/0a0160d6b659f6131a525fe1579e7c463d4c197e
* Rename Object#self to Object#itself to have parity with matz sanctioned ↵David Heinemeier Hansson2014-08-011-2/+2
| | | | method name for Ruby 2.2
* Added Object#self which returns the object itselfDavid Heinemeier Hansson2014-08-011-0/+10
|
* Add implicit receiver support to `Object#with_options`Pavel Pravosud2014-07-291-2/+15
|
* Fixed a compatibility issue with the `Oj` gemGodfrey Chan2014-07-291-3/+3
| | | | | | | | | | | | | `Time#as_json`, `Date#as_json` and `DateTime#as_json` incorrectly depends on a delegation that is set up in `active_support/json/encoding`. We cannot simply require that file in `core_ext/object/json` because it would cause a circular dependency problem (see #12203 for background). We should instead rely on AS's autoload to load that file for us on-demand. To trigger autoload correctly, we need to reference the `AS::JSON::Encoding` constant instead of using the delegated version. Fixes #16131.
* Merge pull request #15629 from akshay-vishnoi/test-to_paramRafael Mendonça França2014-07-282-66/+59
|\ | | | | Define Hash#to_query and set Hash#to_param as alias to it; with test cases
| * Move to_param to to_query, also Improve testsAkshay Vishnoi2014-06-202-66/+59
| |
* | [ci skip] BigDecimal#duplicable? returns false in 1.9.xAkshay Vishnoi2014-06-131-1/+1
| |
* | Revert "remove unnecssary require of `to_param`, as `to_query` is already ↵Rafael Mendonça França2014-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | require `to_param`" Revert "No need to require to_param, it is already required in to_query.rb" This reverts commits ccdd97662e1fb00c23c90d59f65c091904959561 and d697ee14264a90a39cdbe87857656d8b314ac9b7. Reason by @jeremy: These requires are not for implementation dependency. They ensure that requiring array conversions provides to_query, to_param, and other array conversion behaviors. The fact that to_query is implemented in terms of to_param is just a coincidence. If to_query removed its to_param require, then someone requiring array conversions would no longer have to_param available. This change removes these intentional dependencies on to_param in favor of implementation side effects—an undesirable move that's susceptible to regression.
* | No need to require to_param, it is already required in to_query.rbAkshay Vishnoi2014-06-111-1/+0
|/
* Do not check defined?(CGI) on every call #to_queryprintercu2014-05-131-1/+1
|
* No need the else clauseRafael Mendonça França2014-05-041-2/+0
|
* Merge pull request #14949 from bogdan/empty-hash-array-parameterizationRafael Mendonça França2014-05-041-6/+6
|\ | | | | [Fixes #14948] Hash#to_query: right serialization for empty hash and array
| * [Fixes #14948] Hash#to_query: Changed a way how empty hash and empty array ↵Bogdan Gusiev2014-05-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | are serialized Empty Hash or Array should not present in serialization result {a: []}.to_query # => "" {a: {}}.to_query # => "" For more info see #14948.
* | Remove deprecated file(`active_support/core_ext/object/to_json.rb`) and its ↵Kuldeep Aggarwal2014-05-041-5/+0
|/ | | | test case.
* Object#duplicable?Akshay Vishnoi2014-04-161-0/+3
| | | | | | 1. Improve tests 2. Remove unnecessary constant 3. Add docs for BigDecimal#duplicable?
* Fix #to_json for BasicObject EnumerablesSammy Larbi2014-03-142-2/+2
|
* Go with #presence_in instead of #present_in -- it doesnt sound quite as ↵David Heinemeier Hansson2014-02-241-2/+2
| | | | good, but the closer relationship to #presence over #present is ultimately worth it
* Added Object#present_in to simplify value whitelistingDavid Heinemeier Hansson2014-02-181-0/+12
|
* Fix to_query with empty arrays tooRafael Mendonça França2014-02-061-1/+6
|
* Refatoring the method to avoid shot-circuit returnRafael Mendonça França2014-02-051-4/+7
|
* Fixed "Hash#to_param confused by empty hash values #13892"Hincu Petru2014-02-051-0/+1
|
* Add support for JSON time_precision to Time and DateTimeAndrew White2014-01-261-4/+4
|
* blank? and present? commit to return singletons [Xavier Noria & Pavel Pravosud]Xavier Noria2013-12-281-18/+42
| | | | | | | | | | | | | | | | | | The contract of blank? and present? was in principle to return Object, as we generally do, the test suite and description was consistent with that, but some examples had comments like "# => true". This cannot be unclear, we either fix the examples, or update the contract. Since users may be already assuming singletons due to the examples and the fact that they were returned before 30ba7ee, the safest option seems to be to revise the contract and the implementation of String#blank? The motivation for 30ba7ee was to improve the performance of the predicate, the refactor based on === is on par regarding speed. With this commit we start documenting return types using YARD conventions. We plan to document return types gradually.
* Extracted blank matcher regexp to constantPaul Nikitochkin2013-12-281-1/+3
|
* Process::Status should get a :nodoc: [ci skip]Godfrey Chan2013-11-261-1/+1
|