Commit Graph

5698 Commits

Author SHA1 Message Date
Rafael Mendonça França
6599e07674
Remove unused code now that the deprecated file was removed 2017-02-07 15:07:15 -03:00
Rafael Mendonça França
9e98f3f7e6
Deprecate halt_and_display_warning_on_return_false 2017-02-07 12:24:46 -03:00
Rafael Mendonça França
3a25cdca3e
Remove deprecated behavior that halts callbacks when the return is false 2017-02-07 12:19:37 -03:00
Rafael Mendonça França
64f4930afc
Document that string in if and unless option of callbacks are deprecated 2017-02-07 10:46:16 -03:00
Rafael Mendonça França
9b19861ec0
Improve the exception message to direct people to all the possible values 2017-02-07 10:41:44 -03:00
Rafael França
d7bbe075f9 Merge pull request #27608 from kamipo/remove_deprecated_passing_string_to_define_callback
Remove deprecated passing string to define callback
2017-02-07 10:33:28 -03:00
Ryuta Kamizono
09525527a5 Deprecate passing string to :if and :unless conditional options on set_callback and skip_callback 2017-02-04 20:48:29 +09:00
Ryuta Kamizono
f8d3fed167 Remove deprecated passing string to define callback
And raise `ArgumentError` when passing string to define callback.
2017-02-04 20:48:29 +09:00
Jared Beck
e014042bad Docs: Correction: Module::DelegationError
When the delegation target is nil and the allow_nil option is not
in use, a Module::DelegationError is raised.

    class C
      delegate :a, to: :b
        def b
          nil
        end
      end
    C.new.a
    # => Module::DelegationError: C#a delegated to b.a, but b is nil

[ci skip]
2017-02-03 17:27:04 -05:00
kenta-s
20435f3547 Remove redundant right parentheses in number_helper [ci skip] 2017-01-31 20:13:03 +09:00
Rafael Mendonça França
44901ca903
Raise in the initialize not in the execute 2017-01-31 01:15:07 -05:00
Rafael França
6d8fdd136b Merge pull request #27824 from kenta-s/raise-an-error-if-no-block-given
Raise an error if FileUpdateChecker#execute is called with no block
2017-01-31 00:54:01 -05:00
Fumiaki MATSUSHIMA
bdcfdef214 Update Unicode Version to 9.0.0
9.0.0 was released on June 21, 2016

http://blog.unicode.org/2016/06/announcing-unicode-standard-version-90.html

http://www.unicode.org/versions/Unicode9.0.0/

There are some changes about grapheme cluster in Unicode 9.0.0:

http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules

------------

I noticed that `unpack_graphemes` returns [Other] when the argument is Other ÷ Prepend
(it must be [Other, Prepend]).
But in [Unicode 8.0.0's Prepend has no characters](http://www.unicode.org/reports/tr29/tr29-27.html#Prepend)
so we don't have to backport following patch:

```diff
should_break =
+ if pos == eoc
+   true
```
2017-01-28 16:57:36 +09:00
kenta-s
3585155f1b Raise an error if FileUpdateChecker#execute is called with no block 2017-01-28 00:53:32 +09:00
kenta-s
221489a6e9 Fix broken sample code for EventedFileUpdateChecker [ci skip] 2017-01-28 00:23:14 +09:00
kenta-s
19fc419925 Fix grammar 'an hyphen' -> 'a hyphen' [ci skip] 2017-01-25 23:50:20 +09:00
Jeremy Evans
7da8d76206
Change ActionView ERB Handler from Erubis to Erubi
Erubi offers the following advantages for Rails:

* Works with ruby's --enable-frozen-string-literal option
* Has 88% smaller memory footprint
* Does no freedom patching (Erubis adds a method to Kernel)
* Has simpler internals (1 file, <150 lines of code)
* Has an open development model (Erubis doesn't have a
  public source control repository or bug tracker)
* Is not dead (Erubis hasn't been updated since 2011)

Erubi is a simplified fork of Erubis that contains just the
parts that are generally needed (which includes the parts
that Rails uses).  The only intentional difference in
behavior is that it does not include support for <%=== tags
for debug output.  That could be added to the ActionView ERB
handler if it is desired.

The Erubis template handler remains in a deprecated state
so that code that accesses it directly does not break.  It
can be removed after Rails 5.1.
2017-01-25 01:41:27 -07:00
kenta-s
5db8d7308b Fix sample code for expand_cache_key usage [ci skip] 2017-01-24 20:28:20 +09:00
kenta-s
d1c546ff2a Add module name to BacktraceCleaner usage example [ci skip] 2017-01-22 19:19:13 +09:00
bogdanvlviv
ec3933e14c add missing comment out [ci skip] 2017-01-20 15:41:23 +02:00
yuuji.yaginuma
58156a803e add missing comment out [ci skip] 2017-01-20 16:39:03 +09:00
Jean Boussier
b9bda7fd89 Allocation free Integer#to_s 2017-01-19 15:24:41 +01:00
Corey Ward
1d3ddac7b8 Adjust Module.parent_name to work when frozen; fixes #27637 2017-01-17 22:18:36 -06:00
Akira Matsuda
4ad1a52f5a All currently supported rubies already have LoadError#path 2017-01-17 18:16:21 +09:00
Akira Matsuda
8e2feedd31 else + if = elsif 2017-01-17 18:02:52 +09:00
Kevin McPhillips
f90a08c193 Raise ArgumentError if attempting to transliterate anything that is not a string 2017-01-16 14:40:41 -05:00
Kasper Timm Hansen
7c3a99eeca Revert "Merge pull request #27686 from koic/friendly_bigdecimal_inspect"
The exact inspect output of a BigDecimal is out of scope for what we're trying
to communicate about `dup` and `duplicable?` here.

Adding two examples distracts is disctracting, so keep the docs from before
since our minimal version is Ruby 2.2.2.

[ Koichi ITO, Jon Moss, Kasper Timm Hansen ]

This reverts commit 2163874dedaf83e67599c2930c2686caa165fbad, reversing
changes made to 46fdbc5290335ed38fa9fe2b6b0ef8abe4eccb1b.
2017-01-15 19:49:34 +01:00
Koichi ITO
7b3d663b4d Several representation of BigDecimal has changed in Ruby 2.4.0+ [ci skip]
cf. https://github.com/ruby/bigdecimal/pull/42
2017-01-15 12:01:55 +09:00
Akira Matsuda
b99014bf44 AS::StringInquirer#respond_to_missing? should fallback to super
in case String or any other ancestor class' respond_to_missing? was defined.
2017-01-15 03:38:06 +09:00
Akira Matsuda
a3afd05384 Unused &block parameter 2017-01-15 02:44:03 +09:00
Akira Matsuda
d5fbb04fab AS::ArrayInquirer#respond_to_missing? should fallback to super
in case Array or any other ancestor class' respond_to_missing? was defined.
2017-01-15 02:44:03 +09:00
Akira Matsuda
9360b6be63 class Foo < Struct.new(:x) creates an extra unneeded anonymous class
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
2017-01-13 15:13:47 +09:00
Andrew White
9ae511f550 Add duration constructors for use in Numeric extensions
The Numeric extensions like 1.day, 1.month, etc. shouldn't know
how the internals of ActiveSupport::Duration works.
2017-01-12 10:05:16 +00:00
Andrew White
033f654027 Merge pull request #27610 from Envek/fix_and_speed_up_duration_parsing
Fix inconsistent parsing of Durations with both months and years
2017-01-12 07:20:28 +00:00
Jonas Nicklas
3d78949c74 Make time travel work with subclasses of Time/Date/Datetime
Closes #27614

Previously when calling `now` on a subclass of e.g. `Time` it would return an instance of `Time` instead of returning an instance of the subclass. This way, we always return the correct class.
2017-01-10 11:43:26 +01:00
Andrey Novikov
cb9d0e4864
Fix inconsistent results when parsing large durations and constructing durations from code
ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true

Duration parsing made independent from any moment of time:
Fixed length in seconds is assigned to each duration part during parsing.

Changed duration of months and years in seconds to more accurate and logical:

 1. The value of 365.2425 days in Gregorian year is more accurate
    as it accounts for every 400th non-leap year.

 2. Month's length is bound to year's duration, which makes
    sensible comparisons like `12.months == 1.year` to be `true`
    and nonsensical ones like `30.days == 1.month` to be `false`.

Calculations on times and dates with durations shouldn't be affected as
duration's numeric value isn't used in calculations, only parts are used.

Methods on `Numeric` like `2.days` now use these predefined durations
to avoid duplicating of duration constants through the codebase and
eliminate creation of intermediate durations.
2017-01-09 23:04:48 +03:00
Sean Griffin
98c6e4e56c Merge pull request #27392 from y-yagi/use_same_class_on_compact
ensure `#compact` of HWIDA to return HWIDA
2017-01-06 06:23:24 -05:00
yuuji.yaginuma
d97ba34472 ensure #compact of HWIDA to return HWIDA
`Hash#compact` of Ruby native returns new hash.
Therefore, in order to return HWIDA as in the past version, need to
define own `#compact` to HWIDA.

Related: #26868
2017-01-06 17:49:18 +09:00
Akira Matsuda
5473e390d3 self. is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
2017-01-05 19:58:52 +09:00
Rafael Mendonça França
209bfc0a5c
Fix style guide violations 2017-01-05 00:40:24 -05:00
Rafael Mendonça França
46bb76acad
Make sure we generate keys that can be used with the cipher
We use aes-256-cbc cipher by default and it only accepts keys with 32
bytes at max.

Closes #27576.

[ci skip]
2017-01-04 23:54:03 -05:00
Rafael França
d66789fa0e Merge pull request #26480 from tbrisker/fix-26461
Clarify that mattr_* creates public methods
2017-01-04 23:39:11 -05:00
Akira Matsuda
24bacb3e95 There's no such module 2017-01-05 01:37:36 +09:00
Jon Moss
bb8f57ec30 Remove unnecessary require statements
Should have been removed via 8e43fc5ace8039370f233570863b34821a3be46f.
2017-01-03 20:30:02 -05:00
Sean Griffin
a194ec88fe Merge pull request #27363 from amatsuda/refined_array_sum
Refining Array#sum monkey-patch using Refinements
2017-01-03 13:50:57 -05:00
Kasper Timm Hansen
c6c3b130e1 Fix Symbol#duplicable? for Ruby 2.4.0.
Ruby 2.4.0 has trouble duplicating certain symbols created from
strings via `to_sym`.

It didn't happen with `'symbol'.to_sym.dup` for some reason, but
works fine with the longer string sample.

Once a newer Ruby version with a fix is released we'll get have
a failing test case we can fix.

Ref: #27532
2017-01-01 13:41:24 +01:00
Jon Moss
37d956f45f Bump license years for 2017
Per https://www.timeanddate.com/counters/firstnewyear.html, it's already
2017 in a lot of places, so we should bump the Rails license years to
2017.

[ci skip]
2016-12-31 08:34:08 -05:00
Matthew Draper
ee669ab36f Prefer Regexp#match? over Regexp#=== 2016-12-31 11:42:16 +10:30
Matthew Draper
afe057ebc2 Only add regexes for the new words 2016-12-31 11:42:16 +10:30
Rafael Mendonça França
010e246756
Fix Rubocop violations and fix documentation visibility
Some methods were added to public API in
5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of
the public API.
2016-12-28 21:53:51 -05:00