Commit Graph

5692 Commits

Author SHA1 Message Date
Aaron Patterson
cb976371e4 Merge pull request #17493 from petewest/duration-comparable
Delegate comparison operator to value
2014-11-07 16:43:25 -08:00
Rishi Jain
c0357d789b added example of hash#except, and removed extra whitespaces [ci skip] 2014-11-07 00:09:52 +05:30
Vipul A M
33302fdd14 Fix grouped expression warning - warning: (...) interpreted as grouped expression 2014-11-06 19:19:21 +05:30
Vijay Dev
60c45b0d0a Merge pull request #17526 from rishijain/update_docs_6
Update docs 6
2014-11-06 17:31:16 +05:30
Yves Senn
5dd3c3b2a0 docs, synchronize 4.2. release notes. [ci skip]
/cc @chancancode
2014-11-06 12:16:11 +01:00
Rishi Jain
54a9653a04 added example of squish!, remove, test case for multiple occurrence of
pattern removal

added example for string#remove and test case for remove of multiple occurence of pattern

removed extra whitespaces
2014-11-06 13:04:56 +05:30
Yves Senn
00ae750b23 Merge pull request #15956 from zuhao/refactor_activesupport_dependencies_test
Cleanup loaded features and constants after dependency tests.
2014-11-05 15:40:37 +01:00
Yves Senn
768b4ea24d tests, add note about the usage of a specific timezone. Closes #17448. 2014-11-05 11:28:25 +01:00
Yves Senn
57f72f2492 Merge pull request #17515 from prathamesh-sonpatki/rm-require
Removed the unused require of proxy_object
2014-11-05 10:32:47 +01:00
Prathamesh Sonpatki
e010946052 Removed the unused require of proxy_object and test related to it
- Reference : https://github.com/rails/rails/pull/17493#issuecomment-61739359
- Duration stopped inheriting from ProxyObject in https://github.com/rails/rails/pull/16574
2014-11-05 15:00:19 +05:30
Prathamesh Sonpatki
e130a0e7b4 Fix broken string_ext_test due to change in timezone
- Russian time was changed to UTC+3 from UTC+4 recently. This broke the
  string_to_ext test.
2014-11-05 14:27:07 +05:30
Vijay Dev
b670fadb97 fix typo [ci skip] 2014-11-04 18:47:06 +05:30
Rishi Jain
06467ad7fe fixed typo [ci skip] 2014-11-04 09:13:12 +05:30
Rishi Jain
78d4f2bcfb added example for hash slice method [ci skip] 2014-11-04 09:08:57 +05:30
Peter West
2e085f67d4 Delegate comparison operator to value 2014-11-03 16:34:44 +00:00
Rafael Mendonça França
af9702c015 Merge pull request #17487 from pabloh/avoid_allocations
Avoid unnecessary allocations and method calls
2014-11-03 12:14:53 -02:00
Rafael Mendonça França
4259cc0c50 Merge pull request #17383 from rwz/string-remove
Make `String#remove` and `String#remove!` accept multiple arguments

Conflicts:
	activesupport/CHANGELOG.md
2014-11-03 12:09:26 -02:00
Pablo Herrero
0488d00211 Avoid unnecessary allocations/calls 2014-11-02 21:40:47 -03:00
Pablo Herrero
861b70e92f Call gsub with a Regexp instead of a String for better performance 2014-11-01 20:23:29 -03:00
Godfrey Chan
4daebedcc4 Prepare for 4.2.0.beta4 release 2014-10-30 14:12:24 -07:00
claudiob
64b09823e6 Remove redundant to_s in interpolation 2014-10-30 08:48:32 -07:00
Pablo Herrero
c02a7e4f82 Do gsub with a regexp instead of a string 2014-10-29 16:20:52 -03:00
Xavier Noria
e595d91ac2 edit pass over all warnings
This patch uniformizes warning messages. I used the most common style
already present in the code base:

* Capitalize the first word.

* End the message with a full stop.

* "Rails 5" instead of "Rails 5.0".

* Backticks for method names and inline code.

Also, converted a few long strings into the new heredoc convention.
2014-10-28 17:47:32 -07:00
Ryunosuke SATO
44260581be Fix doc markup for NumberHelper [ci skip]
The character "*" is unnecessary in option candidates.
This incorrect markup was injected in e8c9aeca .
2014-10-29 00:32:43 +09:00
Pablo Herrero
1897d3a5d2 Optimize TimeWithZoneTest#strftime 2014-10-27 21:43:12 -03:00
Rafael Mendonça França
89397d09eb Prefix internal method with _
This will avoid naming clash with user defined methods
2014-10-25 17:12:19 -07:00
Pavel Pravosud
73ad151030 Make String#remove and String#remove! accept multiple arguments 2014-10-25 18:06:02 -04:00
Xavier Noria
ae07806858 fixes circularity check in dependencies
The check for circular loading should depend on a stack of files being
loaded at the moment, rather than the collection of loaded files.

This showed up indirectly in #16468, where a misspelled helper would
incorrectly result in a circularity error message.

References #16468
2014-10-25 14:06:33 +02:00
Akira Matsuda
c4767e13d4 instance_eval is evil 2014-10-25 12:59:37 +09:00
Akira Matsuda
ed03d4eaa8 Avoid creating range objects (take II) 2014-10-25 12:59:37 +09:00
Godfrey Chan
cd2d3664e3 Revert a change made to the example in 1ac4525
@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]
2014-10-24 14:22:22 -07:00
Zachary Scott
ea3cd40554 Include return value in examples added in #17378 [ci skip] 2014-10-24 13:10:50 -07:00
Eugene Gilburg
df1dda8b71 Improved try documentation [ci skip]
- 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
2014-10-24 13:09:05 -07:00
Godfrey Chan
016af48b86 Merge pull request #17377 from aripollak/dry-try-bang
DRY up try/try!
2014-10-23 19:05:46 -07:00
Guillermo Iguaran
1d9ebec0a9 Merge pull request #17369 from rails/secure_compare
Secure compare
2014-10-23 22:57:26 -03:00
Ari Pollak
22f6189a55 DRY up try/try! 2014-10-23 21:47:16 -04:00
Melanie Gilman
6c75a11199 Reword documentation for uncountable [ci skip] 2014-10-23 13:22:10 -05:00
Guillermo Iguaran
4b11dea391 Use AS secure_compare in AS::MessageVerifier 2014-10-23 14:54:17 -03:00
Guillermo Iguaran
c8c660002f Add AS::SecurityUtils.secure_compare for constant time string comparison 2014-10-23 14:54:06 -03:00
Godfrey Chan
04b40b3deb Update CHANGELOG and release notes for e98f2a7 2014-10-22 16:34:58 -07:00
Ari Pollak
e98f2a74eb Bring try! into parity with try.
Based on commit 5e51bdda.
2014-10-22 18:34:43 -04:00
Rafael Mendonça França
b9fcce3944 Merge pull request #17302 from claudiob/replace-slower-block-call-with-faster-yield
Replace (slower) block.call with (faster) yield
2014-10-18 17:08:24 -03:00
Zachary Scott
7b71d8cfab Revert "Replace (slower) block.call with (faster) yield"
This reverts commit 0ab075e75f58bf403f7ebe20546c7005f35db1f6.
2014-10-18 13:04:02 -07:00
Pramod Sharma
68fd1a3b23 [ci skip] Add Doc of with_options for the case when inherited default options and original options have same keys 2014-10-18 12:59:51 -07:00
claudiob
0ab075e75f Replace (slower) block.call with (faster) yield
Performance optimization: `yield` with an implicit `block` is faster than `block.call`.
See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark:

```ruby
require 'benchmark/ips'

def fast
 yield
end

def slow(&block)
 block.call
end

Benchmark.ips do |x|
 x.report('fast') { fast{} }
 x.report('slow') { slow{} }
end

# => fast    154095 i/100ms
# => slow     71454 i/100ms
# =>
# => fast  7511067.8 (±5.0%) i/s -   37445085 in   4.999660s
# => slow  1227576.9 (±6.8%) i/s -    6145044 in   5.028356s
```
2014-10-18 12:59:51 -07:00
claudiob
d43b1b0a9e Add necessary 'require reverse_merge' to HAWI.rb
Hashes with indifferent access should support `reverse_merge` out-of-the-box
but they don't; for instance the following code fails:

```ruby
require 'active_support'
require 'active_support/hash_with_indifferent_access'
hash = HashWithIndifferentAccess.new key: :old_value
hash.reverse_merge key: :new_value
```

This PR fixes the case above by simply requiring
`active_support/core_ext/hash/reverse_merge` in `hash_with_indifferent_access.rb`
and adding a test that confirms the fix.

---

Here are more details about the bugfix.
Currently, `reverse_merge` is [defined in HashWithIndifferentAccess](4e8ea13ba1/activesupport/lib/active_support/hash_with_indifferent_access.rb (L208))
by invoking `super`, that is by invoking `Hash#reverse_merge`:

```ruby
def reverse_merge(other_hash)
  super(self.class.new_from_hash_copying_default(other_hash))
end
```

However, Ruby's `Hash` does not have the `reverse_merge` by default: it must be
added by ActiveSupport, and that requires the following line of code to be
present:

```ruby
require 'active_support/core_ext/hash/reverse_merge'
```
2014-10-17 09:11:04 -07:00
Yves Senn
400b0818fa some changelog formatting. [ci skip] 2014-10-16 09:11:41 +02:00
Robin Neumann
61f157e11c specify protocol for external links
to ensure correct parsing result of rdoc
2014-10-15 16:15:20 +02:00
Rafael Mendonça França
664a0fa9cf Merge pull request #17230 from robertoz-01/master
atomic_write rescue also Errno::EACCES
2014-10-13 10:52:37 -03:00
Erik Michaels-Ober
8bb33e920a Replace Enumerable#reverse.each with Enumerable#reverse_each 2014-10-13 11:47:16 +01:00