| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Previously `String#to_time` returned the midnight of the current date
in some cases where there was no relavant information in the string.
Now the method returns `nil` instead in those cases.
Fixes #22958.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added test cases
Using kwargs instead of three seperate functions
Updated parameterize in transliterate.rb
Updated parameterize in transliterate.rb
Added deprecation warnings and updating RDoc+Guide
Misspelled separtor. Fixed.
Deprecated test cases and added support to parameterize with keyword parameters
Squashing commits.
Fixed test cases and added deprecated test cases
Small changes to Gemfile.lock and CHANGELOG
Update Gemfile.lock
|
|
|
|
|
|
|
| |
Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8
strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`.
Prevents user-entered input passed from a querystring into a form field from
causing invalid byte sequence errors.
|
| |
|
|\
| |
| |
| | |
Fix a backtracking problem in String#truncate_words
|
|/
|
|
| |
Fixes #19070.
|
|
|
|
| |
onwards.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
pattern removal
added example for string#remove and test case for remove of multiple occurence of pattern
removed extra whitespaces
|
| |
|
|
|
|
|
| |
- Russian time was changed to UTC+3 from UTC+4 recently. This broke the
string_to_ext test.
|
| |
|
|
|
|
|
| |
Ruby 2.2 knows this, and no longer matches it with [[:space:]], so it's
not a good candidate for testing String#squish.
|
| |
|
| |
|
| |
|
|\
| |
| |
| | |
Word truncation
|
|/ |
|
|
|
|
|
| |
It’s used at so many places that extracting it out into a helper file
is worth doing.
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
When calling String#pluralize with count=1 then it returned same
string, but with count other than 1, returned new string.
After:
String#pluralize always return a new string.
=> Prevent mutation of a string inadvertently.
|
|
|
|
|
|
|
| |
While calling String#first or String#last with zero or a Fixnum < the
string's length returns a new string, a Fixnum >= the string's length
returns the string itself. This inconsistency can lead to inadvertent
mutation of a string.
|
|
|
|
|
| |
Change to require all active_support/deprecation since that's the actual
entry point for the deprecation methods.
|
| |
|
|
|
|
|
|
|
| |
Make `#prepend` method modify instance in-place and return self
instead of just returning modified value. That is exactly what
`#prepend!` method was doing previously, so it's deprecated from
now on.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
So strings can be humanized without being capitalized:
'employee_salary'.humanize # => "Employee salary"
'employee_salary'.humanize(capitalize: false) # => "employee salary"
|
| |
|
|
|
|
| |
String#gsub(pattern, '')
|
|
|
| |
core extensions (`core_ext/string/encoding`).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The changes in b79adc4323 had a bug where if the time in the String
was in standard time but the current time was in daylight savings then
the calculated adjustment was off by an hour.
This commit fixes this and adds extra tests for the following:
* time in string is standard time, current time is standard time
* time in string is standard time, current time is daylight savings
* time in string is daylight savings, current time is standard time
* time in string is daylight savings, current time is daylight savings
Fixes #10306.
|
| |
|
|\
| |
| | |
Improve String#squish whitespaces matching
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
* ASCII_STRING was not an ASCII String
* BYTE_STRING was not an in valid UTF-8 String
* added an assertion for non-UTF-8 String
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
Use the standard library's `DateTime.parse` because it's marginally
faster and supports partial date/time strings.
Benchmark:
user system total real
old 3.980000 0.000000 3.980000 ( 3.987606)
new 3.640000 0.010000 3.650000 ( 3.641342)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit standardises the return value of `to_time` to an instance
of `Time` in the local system timezone, matching the Ruby core and
standard library behavior.
The default form for `String#to_time` has been changed from :utc to
:local but research seems to suggest the latter is the more common form.
Also fix an edge condition with `String#to_time` where the string has
a timezone offset in it and the mode is :local. e.g:
# Before:
>> "2000-01-01 00:00:00 -0500".to_time(:local)
=> 2000-01-01 05:00:00 -0500
# After:
>> "2000-01-01 00:00:00 -0500".to_time(:local)
=> 2000-01-01 00:00:00 -0500
Closes #2453
|
|
|
|
|
|
|
|
|
|
| |
I did this because to_date gives a very unhelpful error message if you
do not pass in a correct date. In the process I think this cleans up the
code nicely and even better it tends to be slightly faster than the
current implementation.
Benchmark
https://gist.github.com/4440875
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|