Commit Graph

5738 Commits

Author SHA1 Message Date
Zachary Scott
06e1881fd3 Fix syntax error with RDoc directive,
this should be `:nodoc:` in order to be parsed.
2014-12-20 14:52:26 -08:00
Vijay Dev
15590c1a2a Merge branch 'master' of github.com:rails/docrails 2014-12-20 14:26:21 +00:00
Carlos Antonio da Silva
4073413d3c Use released I18n 0.7.0 2014-12-19 15:09:06 -02:00
claudiob
1d19a3a42a Add docs for AS::TestCase::test_order
Document `test_order` and `test_order=` from `ActiveSupport::TestCase`.

[ci skip]
2014-12-18 11:20:32 -08:00
claudiob
4c0ef7708b Add docs for Numeric time-related methods
Add docs for `minutes`, `hours`, `days`, `weeks` and `fortnights`.
Fix docs for `in_milliseconds`.

[ci skip]
2014-12-17 16:55:08 -08:00
claudiob
23c8f6918d Replace #=> with # => [ci skip]
@rafaelfranca suggested in f7c7bcd9 that code examples should display
the result after  `# =>` and not after `#=>`.

This commit replaces *all* the occurrences of `#=>` in the code documentation
(mostly added by me 😭) with the suggested `# =>`.
2014-12-17 16:44:51 -08:00
claudiob
78789b7acd Add docs for Numeric#*_bytes methods
Add docs for `kilobytes`, `megabytes`, `gigabytes`, `terabytes`,
`petabytes` and `exabytes`. Fix docs for `bytes`.

[ci skip]
2014-12-17 16:22:47 -08:00
claudiob
a4069cdb42 Add docs for Time#find_zone
Also improves docs for `Time#find_zone!`

[ci skip]
2014-12-17 15:42:28 -08:00
claudiob
0de9a6ed21 Fix docs for AS::Notifications::Event#duration
Stems from comments by @zzak on e07f3dd:

* e07f3ddcac (commitcomment-9015634)
* e07f3ddcac (commitcomment-9015639)

[ci skip]
2014-12-17 14:01:04 -08:00
Rafael Mendonça França
320f75baaf Merge pull request #18063 from claudiob/remove-as-time-with-zone-since
Replace AS::TimeWithZone#since with alias to +
2014-12-17 19:51:52 -02:00
Rafael Mendonça França
eec0441c11 Merge pull request #18072 from exAspArk/thread_safe_gem_version
Use thread_safe gem version greater or equal to 0.3.4
2014-12-17 19:44:36 -02:00
claudiob
e07f3ddcac Add docs for AS::Notifications::Event#duration
[ci skip]
2014-12-17 12:10:43 -08:00
Evgeny Li
c71f182c2e use thread_safe gem version greater or equal to 0.3.4 2014-12-17 20:04:35 +03:00
claudiob
05affb2cf9 Replace AS::TimeWithZone#since with alias to +
Stems from [Google group discussion](https://groups.google.com/forum/#!topic/rubyonrails-core/jSPbP-TNLb0).

Currently `AS::TimeWithZone` has two methods to add an interval to a time:
`+(other)` and `since(other)` ([docs](http://edgeapi.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html)).

The two methods are "pretty much" equivalent in every case:

1. When adding any interval to an `AS::TimeWithZone` representing a `Time`:

  ```ruby
  t = Time.now.in_time_zone       #=> Thu, 04 Dec 2014 18:56:28 EST -05:00
  t + 1 == t.since(1)             #=> true
  t + 1.day == t.since(1.day)     #=> true
  t + 1.month == t.since(1.month) #=> true
  ```

2. When adding any interval to an `AS::TimeWithZone` representing a `Date`:

  ```ruby
  d = Date.today.in_time_zone     #=> Thu, 04 Dec 2014 00:00:00 EST -05:00
  d + 1 == d.since(1)             #=> true
  d + 1.day == d.since(1.day)     #=> true
  d + 1.month == d.since(1.month) #=> true
  ```

3. When adding any interval to an `AS::TimeWithZone` representing a `DateTime`:

  ```ruby
  dt = DateTime.now.in_time_zone    #=> Thu, 04 Dec 2014 18:57:28 EST -05:00
  dt + 1 == dt.since(1)             #=> true
  dt + 1.day == dt.since(1.day)     #=> true
  dt + 1.month == dt.since(1.month) #=> false
  ```

As you can see, the only case in which they differ is when the interval added
to a `DateTime` is in a format like `1.month`.

However, this usage of "since" is explicitly discouraged by the
[documentation of `DateTime#since`](https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L86L88):

> Returns a new DateTime representing the time a number of seconds since the instance time.
> Do not use this method in combination with x.months, use months_since instead!

And indeed, following this recommendation the correct result is returned:

```ruby
dt + 1.month == dt.months_since 1 #=> true
```

Therefore, my proposal is to remove the method definition of `TimeWithZone#since`
and instead replace it with a simple `alias_method :since, :+`.

The rationale is that the only case where they differ is a case that is
explicitly discouraged as "wrong".

In my opinion, having two methods named `since` and `+` and having to figure
out exactly what the difference is makes the codebase more confusing.

However, I understand this PR is "subjective", so if you feel like it's better
to ignore this, feel free to close the PR.

Thanks!
2014-12-16 16:09:48 -08:00
Rafael Mendonça França
e4c9bd9828 Merge pull request #17980 from gsamokovarov/rescuable-case-operator
Add class level case operator support for error dispatching in Rescuable
2014-12-16 20:21:01 -02:00
Rafael Mendonça França
43ab5433a7 Merge pull request #18031 from claudiob/better-tests-for-callbacks-terminator
Add test for `:skip_after_callbacks_if_terminated`
2014-12-16 14:46:34 -02:00
Vijay Dev
2ed2be1ccc Merge branch 'master' of github.com:rails/docrails 2014-12-15 18:12:29 +00:00
claudiob
8c1889c926 Add test for :skip_after_callbacks_if_terminated
`define_callbacks` from `ActiveSupport::Callbacks` accepts the
`:skip_after_callbacks_if_terminated` option since #4866 but the option
is not tested anywhere.

This commit adds tests and fixes documentation for the option, making it clear
that halting a callback chain only stops following `before_` and `around_`
callbacks by default.
2014-12-14 19:12:54 -08:00
George Millo
cca240ab35 English fix [ci skip] 2014-12-12 13:36:55 +00:00
Genadi Samokovarov
dd96e8e333 Add class level case operator support for error dispatching in Rescuable 2014-12-10 02:34:59 +02:00
yuuji.yaginuma
628580c032 [ci skip] fix typo in MessageVerifier#verify docs 2014-12-10 08:23:15 +09:00
claudiob
d4fd3a18bd Better doc for AS::DateTime#seconds_since_midnight
Adds examples and keeps coherent with the documentation of the
similar method `seconds_until_end_of_day`. [ci skip]
2014-12-04 22:27:49 -08:00
claudiob
ff90458cd7 Add docs for AS::TimeWithZone + and -
The example was taken from the commit message 676d6a6.

[ci skip]
2014-12-04 11:57:12 -08:00
Rafael Mendonça França
54bccc4915 Merge pull request #17913 from claudiob/add-docs-to-time-with-zone
Add documentation to six AS::TimeWithZone methods [ci skip]
2014-12-04 14:17:39 -02:00
claudiob
999603c17f Fix MessageVerifier's #verified in CHANGELOG
[ci skip]

As confirmed by @lleger (the author of `verified`) [in this comment](https://github.com/rails/rails/pull/17727#issuecomment-65488743):

> Actually, it no longer returns false explicitly (bc8cc56), so I guess the CHANGELOG isn't totally accurate. It returns nil instead (but the functionality isn't practically different).
2014-12-04 08:13:22 -08:00
claudiob
d809fc1b85 Add documentation to six AS::TimeWithZone methods
[ci skip]
2014-12-04 08:11:33 -08:00
Rafael Mendonça França
f7c7bcd9c2 Copy-edit the MessageVerifier documentation [ci skip] 2014-12-04 14:09:47 -02:00
Rafael Mendonça França
fc3dbf452e Merge pull request #17905 from claudiob/add-doc-to-message-verifier
Add documentation to MessageVerifier
2014-12-04 13:28:47 -02:00
claudiob
e428ddecec Remove "rescue" clause around "require 'openssl'"
Some `require 'openssl'` statements were surrounded by `rescue` blocks to deal with Ruby versions that did not support `OpenSSL::Digest::SHA1` or `OpenSSL::PKCS5`.

[As @jeremy explains](a6a0904fcb (commitcomment-8826666)) in the original commit:

> If jruby didn't have jruby-openssl gem, the require wouldn't work. Not sure whether either of these are still relevant today.

According to the [release notes for JRuby 1.7.13](http://www.jruby.org/2014/06/24/jruby-1-7-13.html):

> jruby-openssl 0.9.5 bundled

which means the above `rescue` block is not needed anymore.

All the Ruby versions supported by the current version of Rails provide those OpenSSL libraries, so Travis CI should also be happy by removing the `rescue` blocks.

---

Just to confirm, with JRuby:

    $ ruby --version #=> jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26 +jit [darwin-x86_64]
    $ irb
    irb(main):001:0> require 'openssl' #=> true
    irb(main):002:0> OpenSSL::Digest::SHA1 #=> OpenSSL::Digest::SHA1
    irb(main):003:0> OpenSSL::PKCS5 # => OpenSSL::PKCS5

And with Ruby 2.1:

    $ ruby --version #=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
    $ irb
    irb(main):001:0> require 'openssl' #=> true
    irb(main):002:0> OpenSSL::Digest::SHA1 #=> OpenSSL::Digest::SHA1
    irb(main):003:0> OpenSSL::PKCS5 #=> OpenSSL::PKCS5
2014-12-03 21:58:02 -08:00
claudiob
9fd4fbd1fb Add documentation to MessageVerifier
[ci skip]

Complements #17727 and closes ee73d9ff8.

@lleger How do you feel about this?
2014-12-03 21:57:33 -08:00
Rafael Mendonça França
ee73d9ff8d Add some FIXME notes about documentation [ci skip] 2014-12-02 13:57:05 -02:00
Rafael Mendonça França
bc8cc56a2a Prefer object/nil over true/false
This is the project guideline and the reasons are:

* That follows standard Ruby semantics.
* Allows the implementation to avoid artificial code like !! or something ? true : false
* You do not need to rely on the exact type of 3rd party code. For
example, if your method returns str.end_with?('foo') you do not need to
make sure end_with? returns a singleton. Your predicate just propagates
predicate semantics up regardless of what end_with? returns.
2014-12-02 13:10:18 -02:00
Logan Leger
7ad541f955 Add #verified and #valid_message? to MessageVerifier
This commit adds a `#verified` method to
`ActiveSupport::MessageVerifier` which will return either `false` when
it encounters an error or the message. `#verify` continues to raise an
`InvalidSignature` exception on error.

This commit also adds a convenience boolean method on `MessageVerifier`
as a way to check if a message is valid without performing the
decoding.
2014-12-01 21:43:16 -06:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
Rafael Mendonça França
4eb68d8ed4 Merge pull request #17816 from byroot/prevent-numeric-to-s-to-allocate-an-array
Prevent Numeric#to_s from allocating an array
2014-11-29 05:07:40 -02:00
claudiob
96d0f751f9 Bump required Ruby version to 2.1.0
[This article](http://weblog.rubyonrails.org/2014/8/20/Rails-4-2-beta1/#maintenance-consequences-and-rails-5-0) states that:

> Rails 5.0 is in most likelihood going to target Ruby 2.2.

Before the exact minimum version is fully decided, @arthurnn [suggests](https://github.com/rails/rails/pull/17830#issuecomment-64940383)
that **at least** version 2.1.0 **must** be required by the `gemspec` files.
2014-11-28 22:59:51 -08:00
Jean Boussier
e3cba67824 Prevent Numeric#to_s from allocating an array 2014-11-28 15:25:15 -05:00
bigtone1284
c05cf18a6a fixed indent of end in jdom.rb 2014-11-28 14:23:51 -05:00
Rafael Mendonça França
f25ad07f5a Start Rails 5 development 🎉
We will support only Ruby >= 2.1.

But right now we don't accept pull requests with syntax changes to drop
support to Ruby 1.9.
2014-11-28 15:00:06 -02:00
Sean Griffin
0349516ddb Document String#html_safe [ci skip]
It should be part of the documented public API, since we have an entire
section of the guides dedicated to it. Documented in a way that
addresses the concerns which kept it undocumented in the past.
2014-11-24 14:09:00 -07:00
Benjamin Fleischer
a25753b299 Update to Unicode 7.0.0
7.0.0 was released on June 16, 2014

http://unicode-inc.blogspot.com.ar/2014/10/unicode-version-70-complete-text-of.html

ruby bin/generate_tables
2014-11-15 03:40:43 -06:00
Ryan Mohr
8573de4d10 Abstract encoding strategy for ActiveSupport::MessageVerifier 2014-11-12 12:48:44 -10:00
Rafael Mendonça França
d99f964522 Merge pull request #17047 from betesh/master
Time includes DateAndTime::Zones acts_like(:time)
2014-11-11 14:07:25 -02:00
Xavier Noria
0ed6ebcf90 dependencies.rb: keep the decorated #load and #require private [closes #17553] 2014-11-10 14:29:29 -08:00
Rishi Jain
30af171af1 added description for rails generators, and fixed sentence formation for active_support/notifications [ci skip] 2014-11-10 08:11:49 +05:30
betesh
f0d0c0fa1b Time includes DateAndTime::Zones acts_like(:time) 2014-11-09 11:44:56 -05:00
Aaron Patterson
cb976371e4 Merge pull request #17493 from petewest/duration-comparable
Delegate comparison operator to value
2014-11-07 16:43:25 -08:00
Rishi Jain
c0357d789b added example of hash#except, and removed extra whitespaces [ci skip] 2014-11-07 00:09:52 +05:30
Vipul A M
33302fdd14 Fix grouped expression warning - warning: (...) interpreted as grouped expression 2014-11-06 19:19:21 +05:30
Vijay Dev
60c45b0d0a Merge pull request #17526 from rishijain/update_docs_6
Update docs 6
2014-11-06 17:31:16 +05:30