Commit Graph

369 Commits

Author SHA1 Message Date
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
1897d3a5d2 Optimize TimeWithZoneTest#strftime 2014-10-27 21:43:12 -03:00
Pavel Pravosud
73ad151030 Make String#remove and String#remove! accept multiple arguments 2014-10-25 18:06:02 -04:00
Godfrey Chan
04b40b3deb Update CHANGELOG and release notes for e98f2a7 2014-10-22 16:34:58 -07:00
Yves Senn
400b0818fa some changelog formatting. [ci skip] 2014-10-16 09:11:41 +02:00
Matthew Draper
cf66278301 Merge pull request #14146 from chewi/fix-underscore-acronyms-regex
Fix underscore inflector handling of namespaced and adjacent acronyms
2014-10-04 08:16:55 +09:30
Xavier Noria
c935d6f9b5 fixes typo in AS CHANGELOG [ci skip]
References f92ac24.
2014-09-29 23:06:43 +02:00
Agis-
1a787ebb7e Delegation works with reserved words passed to :to
Fixes #16956.
2014-09-19 11:41:41 +03:00
Abdelkader Boudih
46d168e957 Merge pull request #16950 from akshay-vishnoi/docs-rails-4point2
Grammar correction in ActiveSupport CHANGELOG [ci skip]
2014-09-17 21:59:46 +01:00
Akshay Vishnoi
f92ac245bd Grammar correction in ActiveSupport CHANGELOG [ci skip] 2014-09-18 02:27:18 +05:30
Rafael Mendonça França
026289e28e Merge pull request #16948 from akshay-vishnoi/docs-rails-4point2
[ci skip] ActiveSupport CHANGELOG fixes
2014-09-17 17:28:50 -03:00
Akshay Vishnoi
7a8fb281d8 [ci skip] ActiveSupport CHANGELOG fixes
1. spacing issues
2. spelling correction
3. grammar correction
4. Add missing docs
2014-09-18 01:55:29 +05:30
Rafael Mendonça França
acda46d081 Merge pull request #11794 from yoazt/duration-eql
Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.

Conflicts:
	activesupport/CHANGELOG.md
	activesupport/lib/active_support/duration.rb
	activesupport/test/core_ext/duration_test.rb
2014-09-17 16:15:25 -03:00
Agis-
7a3e5ac298 Time#change can now change nanoseconds (:nsec)
Closes #16392.
2014-09-14 02:24:12 +03:00
Kostiantyn Kahanskyi
4bf9d1938b MessageVerifier raises an appropriate exception if the secret is nil
Otherwise this will lead to another error later on 
when generating a signature:
TypeError (no implicit conversion of nil into String).
2014-09-12 15:09:00 +02:00
Godfrey Chan
2b41343c34 Default to sorting user's test cases for now
Goals:

1. Default to :random for newly generated applications
2. Default to :sorted for existing applications with a warning
3. Only show the warning once
4. Only show the warning if the app actually uses AS::TestCase

Fixes #16769
2014-09-08 05:32:16 -07:00
Matthew Draper
ccbb48196e Fix for inflector's incorrect camelCase replacement for acronyms
Fixes #8015, #9756.

[Fred Wu & Matthew Draper]
2014-09-06 04:56:25 +09:30
Agis-
57b2c371f0 Time#change throws exception with an out-of-range :usec
98b46bf5e2
did not properly handled out-of-range `:usec`s.

Passing a `:usec` that's out of range now throws an `ArgumentError` as it
should.

Fixes #16759.
2014-09-04 22:21:38 +03:00
Peter Jaros
fdc5e768ca Methods are not duplicable. 2014-09-03 16:09:15 -04:00
Yves Senn
97e689a0d7 Merge pull request #16450 from tgxworld/dont_swallow_error_when_identifying_constant_from_test_name
Do not swallow exception on NameError within constant.
2014-09-02 08:44:55 +02:00
Yves Senn
3579120367 remove trailing whitespace. [ci skip] 2014-09-02 08:42:44 +02:00
David Heinemeier Hansson
5e51bdda59 We tenderized the wrong method! Object#try already had the yield option, just needed some tenderloving instance_eval to fit the bill 2014-08-29 15:32:24 -07:00
David Heinemeier Hansson
9619450468 Use instance_eval on @tenderlove's suggestion :trollface: 2014-08-29 15:19:32 -07:00
David Heinemeier Hansson
cc0d8fbec9 Update examples to show real worth 2014-08-29 15:04:37 -07:00
David Heinemeier Hansson
141d864e0e Added yield to Object#presence 2014-08-29 14:58:36 -07:00
Robin Dupret
d5578cd177 Follow-up to #16560
For the sake of backward-compatibility, we need to make #instance_of?
return true for Fixnum. On the other hand, the method should still
give true for ActiveSupport::Duration itself which was not the case
before.
2014-08-24 18:17:46 +02:00
Robin Dupret
eb73d7dafa Define the Duration#instance_of? method
Since Duration is extending from ProxyObject which extends itself from
BasicObject, the Duration object doesn't respond to the #instance_of?
method. Thus, the #method_missing hook get triggered, delegating the
method to its `value` attribute.

However, Rubinius' #eql? definition relies on #instance_of?, thus this
will equal to true with a Fixnum (since its `value` attribute is a
Fixnum) while it should not.

The previous behavior was wrong anyway, no matter the implementation.
2014-08-18 15:43:49 +02:00
David Heinemeier Hansson
9f6e82ee47 Fix rounding errors with #travel_to by resetting the usec on any passed time to zero, so we only travel with per-second precision, not anything deeper than that. 2014-08-17 12:52:54 -07:00
Rafael Mendonça França
e81f3c210e Nobody sucks so nobody should call this awful method name 2014-08-12 10:51:41 -03:00
Akira Matsuda
9424b48d39 CHANGELOG entry for TestCase.i_suck_and_my_tests_are_order_dependent! fix 2014-08-12 19:54:23 +09:00
Rafael Mendonça França
ca9736e78c Fix DateTime comparison with DateTime::Infinity object
Fixes #16406
2014-08-06 22:43:37 -03:00
Carlos Antonio da Silva
ab2a35878b Fix AS docs / changelog with wrong method [ci skip] 2014-08-05 10:19:00 -03:00
David Heinemeier Hansson
64d9112222 Rename Object#self to Object#itself to have parity with matz sanctioned method name for Ruby 2.2 2014-08-01 10:30:13 -07:00
David Heinemeier Hansson
702ad710b5 Added Object#self which returns the object itself 2014-08-01 10:07:38 -07:00
Pavel Pravosud
0cb3cc4ff7 Add implicit receiver support to Object#with_options 2014-07-29 16:11:48 -04:00
Godfrey Chan
bf7fbe64f7 Fixed a compatibility issue with the Oj gem
`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.
2014-07-29 00:04:45 -07:00
Arthur Neves
c17c262cfc
Make HWIA copy the default proc too.
[fixes #16279]
2014-07-24 11:48:24 -04:00
Matthew Draper
41679b2b31 Merge pull request #16190 from oss92/word_truncation
Word truncation
2014-07-17 04:31:53 +09:30
root
a9d3b77e49 Added truncate_words method to activesupport strings 2014-07-16 19:48:07 +02:00
Rafael Mendonça França
19fae86fe0 Move uuid_v5 and uuid_v3 to Digest::UUID
These methods are not random so they should not belings to SecureRandom
module.
2014-07-15 19:51:33 -03:00
Rafael Mendonça França
2b2e041506 Add CHANGELOG entry for #13392 [ci skip] 2014-07-15 18:03:12 -03:00
John Paul Ashenfelter
d75992b0b2 DateTime#to_f now preserves fractional seconds.
Previously this method always returns `.0` in the fractional part. This commit
changes it to preserve the fractional seconds instead.

Fixes #15994.
2014-07-02 15:01:35 -07:00
Sean Griffin
b2cf8b251a Add Hash#map_values to ActiveSupport
Didn't get a chance to convert existing code, I'll skim through the code
base to make use of this later this afternoon.
2014-06-29 13:31:43 -06:00
Robin Dupret
d93ae4fca8 Quick pass through Active Support and guides CHANGELOG
[ci skip]
2014-06-29 20:13:49 +02:00
Rafael Mendonça França
3c19402fc3 Merge pull request #15943 from wagenet/cache-instrumentation
Always instrument ActiveSupport::Cache
2014-06-27 18:24:01 -03:00
Robin Dupret
643409dcb0 Make the apply_inflections method case-sensitive
Since d3071db1, the apply_inflections method check if the downcased
version of a string is contained inside the "whitelist" of uncountable
words. However, if the word is composed of capital letters, it won't be
matched in the list while it should.

We can't simply revert to the previous behavior as there is a
performance concern (benchmarked over /usr/share/dict/words):

Before d3071db1  135.610000   0.290000  135.900000 (137.807081)
Since d3071db1   22.170000    0.020000  22.190000  ( 22.530005)
With the patch   22.060000    0.020000  22.080000  ( 22.125771)

Benchmarked with http://git.io/aFnWig

This way, the solution is to put the down-case version of words inside
the @uncountables array.
2014-06-26 14:03:56 +02:00
Arthur Neves
b36df0f6c8
Make dependencies.rb add a name to NameError 2014-06-20 09:44:45 -04:00
Juanjo Bazán
2c515b337f Formatting fix in AS changelog [ci skip] 2014-06-16 20:30:26 -03:00
Adam Panzer
9010274627 fix error with long keys in ActiveSupport::Cache::FileStore 2014-06-10 10:53:48 -07:00
Matthew Draper
b2d070ddf6 Merge pull request #15421 from gchan/time_with_zone_precision
Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
2014-06-05 16:23:47 +09:30