Commit Graph

4403 Commits

Author SHA1 Message Date
Pavel Pravosud
bb1d3c1f8e AS::BasicObject can be inherited from 2012-12-15 20:57:45 +07:00
Brett Carter
8f8397e0a4 Remove unicode character encoding from ActiveSupport::JSON.encode
The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters
not in the Basic Multilingual Plane.  It is possible to escape them
for json using the weird encoding scheme of a twelve-character
sequence representing the UTF-16 surrogate pair (e.g. '𠜎' ->
"\u270e\u263a") but this wasn't properly handled in the escaping code.
Since raw UTF-8 is allowed in json, it was decided to simply pass
through the raw bytes rather than attempt to escape them.
2012-12-14 18:54:32 -05:00
Carlos Antonio da Silva
df9f9b7f3e Convert changelogs to 1.9 hash style and fix some formatting [ci skip] 2012-12-14 20:25:22 -02:00
Aaron Patterson
49219293e5 Merge pull request #8510 from thedarkone/thread_safety_improvements
Thread safety improvements
2012-12-14 11:12:50 -08:00
thedarkone
45448a5788 Replace some global Hash usages with the new thread safe cache.
Summary of the changes:
 * Add thread_safe gem.
 * Use thread safe cache for digestor caching.
 * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
 * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
 * Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
 * Replace synchronisation with TS::Cache usage.
 * Use a preallocated array for performance/memory reasons.
 * Update the controllers cache to the new AS::Dependencies::ClassCache API.
   The original @controllers cache no longer makes much sense after @tenderlove's
   changes in 7b6bfe84f3 and f345e2380c.
 * Use TS::Cache in the connection pool to avoid locking overhead.
 * Use TS::Cache in ConnectionHandler.
2012-12-14 12:18:47 +01:00
Rafael Mendonça França
a565f80bcb Backport thread-local variables from Ruby 2.0 2012-12-11 18:52:02 -03:00
Andrew White
48583f8bf7 Deprecate obsolete Time to DateTime fallback methods
The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
methods were added to handle the limitations of Ruby's native Time
implementation. Those limitations no longer apply so we are deprecating
them in 4.0 and they will be removed in 4.1.
2012-12-11 13:57:05 +00:00
Andrew White
45a6f546b6 Beef up tests for String#in_time_zone and Date#in_time_zone 2012-12-11 13:08:08 +00:00
Andrew White
f0a9e2f852 Clean up 'active_support/time' requires
Rely on the hub files for Time, Date and DateTime classes and
add the requires for String#to_time and String#in_time_zone.
2012-12-11 12:23:30 +00:00
Andrew White
224d82ee59 Deprecate Date#to_time_in_current_zone
The to_time_in_current_zone method doesn't match the naming of the methods
for converting to ActiveSupport::TimeWithZone on Time and DateTime. Since
DateTime inherits from Date that has led to confusion with some users
using the to_time_in_current_zone method with DateTime instances and having
the time part dropped and the UTC offset lost.

This commit fixes this by deprecating the old method and adding a new
in_time_zone method which matches the naming for DateTime and Time. This
should prevent accidently dropping times and UTC offsets when converting
DateTime instances to ActiveSupport::TimeWithZone.
2012-12-11 07:06:34 +00:00
Andrew White
681697813b Add missing at_end_of_* aliases 2012-12-11 06:47:47 +00:00
Andrew White
331a82a1c8 Add String#in_time_zone method
This commit adds a convenience method for converting a string to an
ActiveSupport::TimeWithZone instance using the configured Time.zone or
another passed as an argument.
2012-12-11 06:32:28 +00:00
Jeremy Kemper
8110035623 Revert "Omit directories from gemspec.files for RubyGems 2 compat."
Obviated by rubygems/rubygems@486ed83cc8

This reverts commit bb8923dee093b615615cdfb83b34d1b0bb254f25.
2012-12-09 17:14:27 -07:00
Jeremy Kemper
bb8923dee0 Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.

May revert if rubygems/rubygems#413 is accepted.
2012-12-08 17:18:46 -07:00
Vijay Dev
0a33fcd68b Merge branch 'master' of github.com:lifo/docrails 2012-12-08 23:11:37 +05:30
Claudio B.
e618adbcab Update activesupport/lib/active_support/deprecation/proxy_wrappers.rb
Fix a typo in rdoc (*expect* for *except*)
2012-12-07 16:54:32 -08:00
Francesco Rodriguez
6ee03a40bb Rename ActiveSupport::BasicObject to ActiveSupport::ProxyObject
AS::BasicObject is used for proxy classes. Let's give it a less concerning
name. Also, it avoids the confusion with Ruby's Basic Object.
2012-12-07 14:13:56 -05:00
Andrew White
8942035f42 Add comment about implementation of class_attribute
To prevent future pull requests like #8435 add a comment about the
implementation of class_attribute using class_eval for performance.

[ci skip]
2012-12-06 12:45:25 +00:00
kennyj
180e2e5e9e silence warning: possibly useless use of a constant in void context 2012-12-06 01:10:03 +09:00
claudiob
019df98875 Replace comments' non-breaking spaces with spaces
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).

This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
2012-12-04 22:11:54 -08:00
Vijay Dev
40e16121c0 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/migrations.md
2012-12-04 22:26:16 +05:30
Carlos Antonio da Silva
e1ce84b1a9 Merge pull request #8393 from frodsan/fix_dependend_order_test_example
Ensure original encoding does not change in mb_chars test.
2012-12-03 16:19:37 -08:00
Carlos Antonio da Silva
baa4d79cb1 Use send in Time marshal extensions since the methods are now private
See 9c1b3161f2

All Active Support tests pass in 2.0.0preview2 after this change.
Closes #8409
2012-12-03 21:45:08 -02:00
Andrew White
c89b6c4cdc Only take the date parts from Time.zone.now
When there are missing components in the Hash returned by
Date._parse only the date components should default to the
value of Time.zone.now, the time components should all
default to zero.
2012-12-01 21:05:42 +00:00
Francesco Rodriguez
86dd2f3276 ensure original encoding doesnt change 2012-12-01 15:41:06 -05:00
Carlos Duclos
82ebe186e6 nodoc AS::Testing::ConstantLookup::ClassMethods [ci skip] 2012-12-01 14:58:00 -05:00
HPNeo
96f7ec4537 Add documentation for Hash.from_xml [ci skip] 2012-12-01 14:57:34 -05:00
Florent Guilleux
8dc4041a9b Revert "Remove trailing whitespaces"
This reverts commit 90c887fa7d0c454b7533e208daefc342dea4d5f3.
2012-12-01 13:22:49 -05:00
Florent Guilleux
90c887fa7d Remove trailing whitespaces 2012-12-01 13:20:39 -05:00
Carlos Duclos
abefe32baa nodoc AS::Testing::Pending because is deprecated [ci skip] 2012-12-01 13:00:41 -05:00
Vijay Dev
0181c2da97 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/active_record_validations.md
2012-12-01 23:00:47 +05:30
Uriel Katz
9ee0ffb360 Patched Marshal#load to work with constant autoloading (active_support/dependecies.rb) (issue #8167) 2012-12-01 14:00:16 +02:00
Andrew White
005d910624 Make Time.zone.parse to work with JavaScript date strings
Chrome, Safari and Firefox serialize Date objects to strings such
as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings
are parsed the zone is interpreted as 'GMT-0700' which doesn't
exist in the TzInfo list of timezones.

By taking advantage of the improved date/time handling in 1.9.3
we can use `Date._parse` and the `:offset` value which is parsed
correctly.

Three tests were amended to make them pass:

1.  test_parse_with_old_date

    This needed changing to a different value because the original
    value was before EST was adopted so was being changed to a
    LMT (Local Mean Time) value after the change. It didn't before
    because `DateTime` just has offsets from UTC not timezones.

2.  test_parse_should_not_black_out_system_timezone_dst_jump

    Changed the implementation of this test as the stubs were
    dependent on internal implementation details of the test.
    Confirmed that the modified test still failed when the
    implementation of `parse` was restored to pre-#5571.

3.  test_parse_should_black_out_app_timezone_dst_jump

    Ditto.

Closes #5770.
2012-12-01 11:34:21 +00:00
Francesco Rodriguez
d168d234e3 nodoc AS::Deprecation::InstanceDelegator class [ci skip] 2012-11-29 13:31:00 -05:00
Olek Janiszewski
ce73055139 Add #seconds_until_end_of_day to DateTime and Time 2012-11-29 06:39:32 +01:00
Steve Klabnik
bd852603a1 Simplify String#mb_chars and stop proxying #class
This behavior mattered under Ruby 1.8, but that doesn't matter now
that we don't support it.

In addition, we don't want to proxy the #class method. A test was added
to prevent against regressions.
2012-11-28 13:58:51 -08:00
Steve Klabnik
27b79f4c91 Fix documentation for String#mb_chars.
This documentation has been out of date.
2012-11-28 13:58:51 -08:00
Xavier Noria
46ebce6b49 prevent Dependencies#remove_const from autoloading parents [fixes #8301] 2012-11-28 00:13:14 +01:00
Carlos Antonio da Silva
92da512125 Properly deprecate #pending from AS::TestCase
Check https://github.com/rails/rails/pull/4575#issuecomment-5765575.
2012-11-18 21:34:00 -02:00
Carlos Antonio da Silva
4913984122 Revert "Merge pull request #4575 from carlosantoniodasilva/remove-test-pending"
This reverts commit 1620df78dff527b4fa3f7b204fa05d1b630aae17, reversing
changes made to 2d000328dfc0d4b297fb4bdcebc9af6c2fb559dc.

Conflicts:
	activesupport/CHANGELOG.md
	activesupport/lib/active_support/test_case.rb
2012-11-18 21:34:00 -02:00
Ryan Davis
c0c87922ba Please use assert_equal instead of diff directly 2012-11-17 01:46:37 -08:00
Vijay Dev
7b70eeed43 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionpack/lib/action_dispatch/routing/redirection.rb
2012-11-17 01:50:49 +05:30
Marc-Andre Lafortune
3c4a0b2e68 Simplify (and optimize) 2012-11-16 03:35:42 -05:00
Marc-Andre Lafortune
22edb664cf Use Integer#div instead of Integer#/ to avoid side effects from mathn 2012-11-16 03:20:55 -05:00
Santiago Pastorino
e6e3317c54 Add docs for CachingKeyGenerator 2012-11-15 23:06:44 -02:00
Santiago Pastorino
d348c43c1c Add nodoc to DummyKeyGenerator since it's a private thing 2012-11-15 23:01:29 -02:00
Santiago Pastorino
ef8b845de7 Merge pull request #8112 from rails/encrypted_cookies
Encrypted cookies
2012-11-15 12:17:25 -08:00
maximerety
2ff888181d Fix another AS::Concern example (class_eval is already called by included) 2012-11-15 19:18:04 +01:00
maximerety
d0ba816fcf Fix AS::Concern example (current example doesn't work) 2012-11-15 19:18:04 +01:00
Rafael Mendonça França
cf3eb6dab0 Merge pull request #8219 from nikitug/threadsafe_xmlmini_with_backend
Make XmlMini.with_backend usable with threads

Conflicts:
	activesupport/CHANGELOG.md
2012-11-15 15:50:39 -02:00