Commit Graph

4958 Commits

Author SHA1 Message Date
Andrew White
88c0ef4d4f Fix handling of offsets with Time#to_s(:iso8601)
Use a lambda to ensure that the generated string respects the offset of
the time value. Also add DateTime#to_s(:iso8601) and Date#to_s(:iso8601)
for completeness.
2013-07-29 12:31:20 +01:00
David Heinemeier Hansson
b67a80de9b Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format for easy Javascript date parsing 2013-07-28 16:34:43 -05:00
Aaron Patterson
586173204c Merge pull request #11608 from arunagw/ruby-from-rubygems
grab executable from rubygems
2013-07-28 13:55:46 -07:00
Vijay Dev
2a71e9cbd4 Merge branch 'master' of github.com:rails/docrails 2013-07-28 19:41:48 +05:30
Rafael Mendonça França
6b7424c230 Merge pull request #11625 from phstc/minor-refactor-code-gardener-grouping
Minor refactor - Uses Enumerable#to_a instead of iterate and add to an array
2013-07-27 15:29:46 -07:00
Pablo Cantero
7ed8934f08 Minor refactor - Uses Enumerable#to_a instead of iterate and add to an
array
2013-07-27 19:25:01 -03:00
Jay Hayes
a99aa3ba1b Fixes typo in Object#try! 2013-07-26 15:18:04 -05:00
Arun Agrawal
f52832de2a grab executable from rubygems
As done here d7fc97d3f90c0e30865d32ce202658f03248cacc
2013-07-26 11:07:25 +02:00
Akira Matsuda
633be2cbbd Be sure to restore the default I18n.locale after changed its value in a test 2013-07-26 04:21:52 +09:00
Akira Matsuda
c48cbb02d7 Fix order dependent tests
Restore default ActiveSupport::XmlMini.backend after tests
2013-07-26 04:17:00 +09:00
Carlos Antonio da Silva
68bbbd470d Move #11546 changelog to the top [ci skip] 2013-07-22 12:51:36 -03:00
Piotr Sarnacki
782d2f6f83 Merge pull request #11546 from swoop-inc/ss_memory_store_cache_size
[Fixes #11512] improves cache size calculation in MemoryStore
2013-07-22 08:05:07 -07:00
Simeon Simeonov
51d9b9a821 [Fixes #11512] improves cache size calculation in ActiveSupport::Cache::MemoryStore
Previously, the cache size of `ActiveSupport::Cache::MemoryStore` was calculated
as the sum of the size of its entries, ignoring the size of keys and any data
structure overhead. This could lead to the calculated cache size sometimes being
10-100x smaller than the memory used, e.g., in the case of small values.

The size of a key/entry pair is now calculated via `#cached_size`:

    def cached_size(key, entry)
      key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
    end

The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
1.9.3 and 2.0.

Fixes GH#11512 https://github.com/rails/rails/issues/11512
2013-07-22 09:53:03 -04:00
Damien Mathieu
7aae4e5e66 remove useless duplication in include test 2013-07-22 10:31:14 +02:00
Vijay Dev
3613235cc3 Merge branch 'master' of github.com:rails/docrails 2013-07-21 18:08:43 +05:30
Marat Kazbekov
0ebf45cf5d remove duplication in test 2013-07-18 20:48:19 +05:00
Rafael Mendonça França
816b35e781 Fix examples of number_to_percentage
[ci skip]
2013-07-18 10:33:33 -03:00
Thiago Pinto
7b60441d2a Merge branch 'master' of github.com:rails/docrails 2013-07-16 22:58:57 -04:00
Thiago Pinto
786291ded3 Enhancing readability of options for delegate method 2013-07-16 22:58:20 -04:00
Akira Matsuda
2692e38efa Add missing require 2013-07-11 18:53:54 +09:00
Akira Matsuda
5ff00fcd3d Array#to_formatted_s does not call each element's to_s anymore
Array#to_s calls each element's inspect since ruby 1.9
2013-07-11 18:21:11 +09:00
Andrew White
07a4c76a07 Only raise DelegationError if it's is the source of the exception
This fixes situations where nested NoMethodError exceptions are masked
by delegations. This would cause confusion especially where there was a
problem in the Rails booting process because of a delegation in the
routes reloading code.

Fixes #10559
2013-07-11 09:05:32 +01:00
Andrew White
78f7d5b652 Add missing require so that DateTime has the right superclass
If the DateTime core extensions were loaded before the Date core extensions
then you would get a superclass mismatch as DateTime hasn't been defined
yet so it gets set to Object by the acts_like core extension.

Fixes #11206
2013-07-10 16:11:33 +01:00
Andrew White
4d733d2dd4 Add failing test for #9562
Rails 4.0.0 fails when trying to encode an ActiveSupport::TimeWithZone
that wraps a DateTime instance. This is fixed on master so add a test
to prevent regression.

(cherry picked from commit ad01b8da354268cebfae1519c28d19d75576ccb1)
2013-07-10 15:49:09 +01:00
Akira Matsuda
dabcfc4914 Better not mutate the given options Hash 2013-07-10 23:31:02 +09:00
Akira Matsuda
50e11e9897 Simplify Array#in_groups_of code 2013-07-10 22:59:32 +09:00
Akira Matsuda
f660abce9a Speed up Array#split
Benchmark:
          user     system      total        real
old   0.510000   0.000000   0.510000 (  0.506749)
new   0.330000   0.000000   0.330000 (  0.336187)
2013-07-10 22:59:32 +09:00
Akira Matsuda
453617006a Speed up String#truncate
Benchmark:
          user     system      total        real
old   1.550000   0.040000   1.590000 (  1.585866)
new   1.250000   0.040000   1.290000 (  1.287693)
2013-07-10 22:59:32 +09:00
Akira Matsuda
261da32a84 Speed up AS::Inflector.underscore
Benchmark:
          user     system      total        real
old   6.090000   0.120000   6.210000 (  6.202039)
new   5.930000   0.110000   6.040000 (  6.042022)
2013-07-10 19:09:16 +09:00
Akira Matsuda
ff8cbdd05b Speedup AS::Inflector.camelize
Benchmark:
          user     system      total        real
old   5.960000   0.020000   5.980000 (  5.981754)
new   5.740000   0.030000   5.770000 (  5.757201)
2013-07-10 17:41:41 +09:00
Akira Matsuda
cd0d5902dd Speedup AS::Inflector.deconstantize
Benchmark:
          user     system      total        real
old   0.740000   0.000000   0.740000 (  0.744358)
new   0.550000   0.000000   0.550000 (  0.553690)
2013-07-10 17:14:33 +09:00
Akira Matsuda
2ef1fb2c45 Speedup String#to
Benchmark:
1000000.times { str.to(30) }
          user     system      total        real
old   0.490000   0.110000   0.600000 (  0.607374)
new   0.390000   0.000000   0.390000 (  0.387306)
2013-07-10 16:32:04 +09:00
Matt Stopa
3c90f7a258 Add documentation for FileStore#increment and #decrement
[ci skip]
2013-07-10 00:08:10 -06:00
Matt Stopa
d06a98b7d9 Add documentation for #clear on certain Store classes
[ci skip
2013-07-10 00:02:21 -06:00
Matt Stopa
b50bd49aa2 Update the filestore documentation for clear
[ci skip]
2013-07-09 23:19:14 -06:00
Andrew White
c42260a325 Return local time for backwards compatibility 2013-07-09 15:50:14 +01:00
Andrew White
1b3873730b Retain UTC offset when using Time.at_with_coercion
The standard Ruby behavior for Time.at is to return the same type of
time when passing an instance of Time as a single argument. Since the
an ActiveSupport::TimeWithZone instance may be a different timezone than
the system timezone and DateTime just understands offsets the best we
can do is to return an instance of Time with the correct offset.

Fixes #11350.
2013-07-09 13:43:56 +01:00
Neer Friedman
484253515c Fix microsecond precision of Time#at_with_coercion
When Time.at_with_coercion (wraps Time.at) is called with a single
argument that "acts_like?(:time)" it is coerced to integer thus losing
it's microsecond percision.

This commits changes this to use `#to_f` to prevent the problem
2013-07-09 13:43:56 +01:00
Jade Tucker
8471fc0363 Explicitly test for true and false. 2013-07-07 18:59:32 -07:00
Jade Tucker
cad2c8f579 cache.exists? should return true/false 2013-07-07 15:50:22 -07:00
Marc Schütz
20c065594f Make HashWithIndifferentAccess#select always return the hash.
Hash#select! returns nil if the hash didn't change and thus behaves differently
from select, so it's return value can't be used as result for the latter.
2013-07-06 15:56:07 +02:00
Rashmi Yadav
c4885e7956 Adding back deprecation require in all.rb 2013-07-05 17:11:19 +02:00
Yves Senn
19f842b5fa Revert "remove string based terminators for ActiveSupport::Callbacks."
This reverts commit d108672dada7ba97d3b3b56f0c6001cea621061e.

Conflicts:

	activesupport/CHANGELOG.md
2013-07-05 13:53:10 +02:00
Yves Senn
e94be7b04c fix typo in Active Support CHANGELOG. [ci skip] 2013-07-05 12:43:17 +02:00
Yves Senn
d108672dad remove string based terminators for ActiveSupport::Callbacks. 2013-07-05 12:41:15 +02:00
Rashmi Yadav
77b587f942 Removed unsued deprecation require 2013-07-04 19:41:45 +02:00
Aaron Patterson
b785e921d1 method transplanting between modules isn't supported on 1.9 2013-07-03 14:18:54 -07:00
Arun Agrawal
0cb0625c7f Fixed test broken by local_constant_names
depreciation removed
2013-07-03 19:56:49 +02:00
Arun Agrawal
36321d85e9 Remove deprecated String#encoding_aware?
core extensions (`core_ext/string/encoding`).
2013-07-03 19:50:19 +02:00
Arun Agrawal
c9bbac46dd Remove deprecated Module#local_constant_names
in favor of `Module#local_constants`
2013-07-03 19:42:34 +02:00