| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This Adds helpers(jruby_skip & rbx_skip). In Future, Plan is to use
these helpers instead of calls directly to
RUBY_ENGINE/RbConfig/JRUBY_VERSION
|
|
|
|
| |
- Fixes #13667
|
|\
| |
| | |
Adding Hash#compact and Hash#compact! methods
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Adding Hash#compact and Hash#compact! methods
* Using Ruby 1.9 syntax on documentation
* Updating guides for `Hash#compact` and `Hash#compact!` methods
* Updating CHANGELOG for ActiveSupport
* Removing unecessary protected method and lambda for `Hash#compact` implementations
* Performing `Hash#compact` implementation - https://gist.github.com/tinogomes/8332883
* fixing order position
* Fixing typo
|
|/
|
|
|
|
|
|
| |
fixes #13547
The body may use the local cache during rendering. `call`ing the app
doesn't mean that rendering is finished, so we need to wait until
`close` is called on the body.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3.
As described in PR #13627 this commit broke functionality when passing
a negative Fixnum to the `String#to` method:
```ruby
assert_equal "hell", s.to(-2)
```
Before the revert, this failed with:
```
1) Failure:
StringAccessTest#test_#to_with_negative_Fixnum,_position_is_counted_from_the_end [test/core_ext/string_ext_test.rb:275]:
Expected: "hell"
Actual: nil
```
This revert is to keep the functionality on `master` working.
If there is another way to get the performance benefit and keep
the documented functionality we can add that.
/cc @amatsuda @carlosantoniodasilva
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I also extracted the tests from a single bulk method into a separate test-case.
The new tests cover the API described in the docs.
There are two skipped tests, which are broken as of 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3
* #to with negative Fixnum, position is counted from the end
* #from and #to can be combined
This was brought to my attention by #13627.
Closes #13627.
|
|\
| |
| | |
Maintain proleptic gregorian in Time#advance
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Time#advance uses Time#to_date and Date#advance to calculate a new date.
The Date object returned by Time#to_date is constructed with the assumption
that the Time object represents a proleptic gregorian date, but it is
configured to observe the default julian calendar reform date (2299161j)
for purposes of calculating month, date and year:
Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24"
Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04"
This patch ensures that when the intermediate Date object is advanced
to yield a new Date object, that the Time object for return is contructed
with a proleptic gregorian month, date and year.
|
| |
| |
| |
| |
| |
| | |
:mem_cache_store should receive a list of hosts or a dalli client,
otherwise raise it.
Also adding a changelog.
|
| |
| |
| |
| |
| |
| |
| | |
:mem_cache_store require dalli, rescue Dalli exceptions, and follow Dalli API.
Memcached gem, for instance, doesnt work anymore, as the API are different.
As we already require one client, we should make sure that client works, and not accept others, and if someone wants to use another memcache client they can write their own store adapter.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
before:
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
=> "3.14158999999999988261834005243144929409027099609375"
after:
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
=> "3.14159000000000000000000000000000000000000000000000"
|
| | |
|
|\ \
| | |
| | | |
Fixed configurable.rb regular expression name check
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Prevent creation of instance methods when `instance_reader = false`, Grammar checks, Conditional statements combined
|
| | |
| | |
| | |
| | | |
checks, Conditional statements combined
|
| | |
| | |
| | |
| | |
| | |
| | | |
Change most tests to make use of assert_raise returning the raised
exception rather than relying on a combination of flunk + rescue to
check for exception types/messages.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In Minitest, the second argument of assert_raise(s) accepts a string as
the message that should be shown in case of a failure in the assertion
(eg nothing was raised when it should), and not the exception message to
be matched.
To do that we need to save the exception returned from assert_raise(s)
into a local variable and check for the exception message using it.
|
| | |
|
|\ \
| | |
| | | |
Change all `MiniTest` to `Minitest`
|
| | |
| | |
| | |
| | |
| | |
| | | |
renamed to `Minitest`
Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| | |
A natural, low-ceremony way to separate responsibilities within a class.
Imported from https://github.com/37signals/concerning#readme
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Interpolation was untested and did not work with hash arguments.
Adds
- support for interpolation with hash argument
- tests for the above
- tests for safe/unsafe interpolation
|
|\ \
| | |
| | | |
Fix test-error introduced by #10635.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`Base64.strict_decode64`.
This broke natural order of things for `StaleSessionCheck#stale_session_check!` which tried auto_loading a class based on `ArgumentError` message , and later retrying the `Marshal#load` of class, successfully allowing auto_loading.
This PR tries to fix this behavior by forwarding `ArgumentError` 's not raised by `Base64.strict_decode64` , as is, ahead to `StaleSessionCheck#stale_session_check!`
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
File 'empty_bool.rb' was introduced around 4 years ago in
c10958fbddb22052e7cbe5fe6b825cda3cb26e48 to remove method redefined
warning in AS test suite, however we do not have such need for reuse
anymore, so we can safely move the constants back to the file where
they are currently used and get rid of the extra file/require.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
#13204]
load_missing_constant is a private method that basically plays the role of const_missing.
This method has an error condition that is surprising: it raises if the class or module
already has the missing constant. How is it possible that if the class of module has
the constant Ruby has called const_missing in the first place?
The answer is that the from_mod argument is self except for anonymous modules, because
const_missing passes down Object in such case (see the comment in the source code of the
patch for the rationale).
But then, it is better to pass down Object *if Object is also missing the constant* and
otherwise err with an informative message right away.
|
|\ \
| | |
| | | |
Use `Base.strict_decode64` instead of `Base.decode64`
|
| |/
| |
| |
| | |
Also reduce extra object allocation by creating string directly instead of join on Array
|
| |
| |
| |
| |
| |
| |
| | |
Calling Kernel#silence_stream creates a new file descriptor which isn't
closed after it is used. As a result calling silence_stream multiple
times leads to a build up of loose file descriptors and can cause issues
in environments where garbage collection isn't run often.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Ruby's Date class automatically gives us #yesterday, #today,
and #tomorrow. And ActiveSupport has a handy Time.zone.today
for getting a localized version. But there was no localized
version of #yesterday or #tomorrow. Until now.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
keys. Also, show the wrong value as it was entered.
{ :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: failore
{ 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: failore
{ 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: "failore". Valid keys are: :failure, :funny
{ :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: :failore. Valid keys are: :failure, :funny
Conflicts:
activerecord/CHANGELOG.md
Closes #11624.
|
|\ \
| | |
| | | |
CHANGELOG for JSON refactor + added back the `encode_big_decimal_as_string` option with warning
|
| | |
| | |
| | |
| | |
| | | |
Also added the missing CHANGELOG entry for #12183 @ 80e7552073 and
4d02296cfb.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Refactor and clean up number helpers
Conflicts:
activesupport/lib/active_support/number_helper.rb
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Due to the overall complexity of each method individually as well as the
global shared private module methods, this pulls each helper into it's
own converter class inheriting from a generic `NumberBuilder` class.
* The `NumberBuilder` class contains the private methods needed for each helper
method an eliminates the need for special definition of specialized private
module methods.
* The `ActiveSupport::NumberHelper::DEFAULTS` constant has been moved
into the `NumberBuilder` class because the `NumberBuilder` is the only
class which needs access to it.
* For each of the builders, the `#convert` method is broken down to
smaller parts and extracted into private methods for clarity of purpose.
* Most of the mutation that once was necessary has now been eliminated.
* Several of the mathematical operations for percentage, delimited, and
rounded have been moved into private methods to ease readability and
clarity.
* Internationalization is still a bit crufty, and definitely could be
improved, but it is functional and a bit easier to follow.
The following helpers were extracted into their respective classes.
* `#number_to_percentage` -> `NumberToPercentageConverter`
* `#number_to_delimited` -> `NumberToDelimitedConverter`
* `#number_to_phone` -> `NumberToPhoneConverter`
* `#number_to_currency` -> `NumberToCurrencyConverter`
* `#number_to_rounded` -> `NumberToRoundedConverter`
* `#number_to_human_size` -> `NumberToHumanSizeConverter`
* `#number_to_human` -> `NumberToHumanConverter`
|
|\ \ \ \
| | | | |
| | | | | |
Unify cattr and mattr accessors declarations
|
| | |/ /
| |/| | |
|
|/ / /
| | |
| | |
| | | |
[ci skip]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In Ruby 2.0.0-p353 there was a
[commit](https://github.com/ruby/ruby/commit/66915c507777c5e3a978fa73de25db763efd9206)
that switched case matching from actual sending `===` method to magic lookup,
that does not see it in `method_missing`. It's hard to predict how exactly and
when exactly this bug will be solved so here I suggest a solution of defining
it in Duration directly.
In Ruby 2.0.0-p353 without the added fix added test crashes to segmentation
fault.
|
| | | |
|