diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-14 02:13:00 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-14 04:12:33 -0300 |
commit | b451de0d6de4df6bc66b274cec73b919f823d5ae (patch) | |
tree | f252c4143a0adb3be7d36d543282539cca0fb971 /railties/guides/source/active_support_core_extensions.textile | |
parent | 1590377886820e00b1a786616518a32f3b61ec0f (diff) | |
download | rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.gz rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.bz2 rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.zip |
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 8ccfc8e304..9b3bb1da15 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -348,7 +348,7 @@ That idiom may convey _grouping_ to the reader as well. For example, say you wan <ruby> I18n.with_options :locale => user.locale, :scope => "newsletter" do |i18n| subject i18n.t :subject - body i18n.t :body, :user_name => user.name + body i18n.t :body, :user_name => user.name end </ruby> @@ -762,7 +762,7 @@ class Counter end </ruby> -The method receives the name of an action, and a +:with+ option with code. The code is evaluated in the context of the receiver each time the method is invoked, and it should evaluate to a +Mutex+ instance or any other object that responds to +synchronize+ and accepts a block. +The method receives the name of an action, and a +:with+ option with code. The code is evaluated in the context of the receiver each time the method is invoked, and it should evaluate to a +Mutex+ instance or any other object that responds to +synchronize+ and accepts a block. NOTE: Defined in +active_support/core_ext/module/synchronization.rb+. @@ -1107,7 +1107,7 @@ module ActiveRecord end </ruby> -Since values are copied when a subclass is defined, if the base class changes the attribute after that, the subclass does not see the new value. That's the point. +Since values are copied when a subclass is defined, if the base class changes the attribute after that, the subclass does not see the new value. That's the point. NOTE: Defined in +active_support/core_ext/class/inheritable_attributes.rb+. @@ -1139,7 +1139,7 @@ NOTE: Defined in +active_support/core_ext/class/subclasses.rb+. h5. +descendants+ -The +descendants+ method returns all classes that are <tt><</tt> than its receiver: +The +descendants+ method returns all classes that are <tt><</tt> than its receiver: <ruby> class C; end @@ -1260,7 +1260,7 @@ Pass a +:separator+ to truncate the string at a natural break: <ruby> "Oh dear! Oh dear! I shall be late!".truncate(18) -# => "Oh dear! Oh dea..." +# => "Oh dear! Oh dea..." "Oh dear! Oh dear! I shall be late!".truncate(18, :separator => ' ') # => "Oh dear! Oh..." </ruby> @@ -1751,7 +1751,7 @@ The methods +to_date+, +to_time+, and +to_datetime+ are basically convenience wr <ruby> "2010-07-27".to_date # => Tue, 27 Jul 2010 "2010-07-27 23:37:00".to_time # => Tue Jul 27 23:37:00 UTC 2010 -"2010-07-27 23:37:00".to_datetime # => Tue, 27 Jul 2010 23:37:00 +0000 +"2010-07-27 23:37:00".to_datetime # => Tue, 27 Jul 2010 23:37:00 +0000 </ruby> +to_time+ receives an optional argument +:utc+ or +:local+, to indicate which time zone you want the time in: @@ -3032,14 +3032,14 @@ h6. +ago+, +since+ The method +ago+ receives a number of seconds as argument and returns a timestamp those many seconds ago from midnight: <ruby> -date = Date.current # => Fri, 11 Jun 2010 +date = Date.current # => Fri, 11 Jun 2010 date.ago(1) # => Thu, 10 Jun 2010 23:59:59 EDT -04:00 </ruby> Similarly, +since+ moves forward: <ruby> -date = Date.current # => Fri, 11 Jun 2010 +date = Date.current # => Fri, 11 Jun 2010 date.since(1) # => Fri, 11 Jun 2010 00:00:01 EDT -04:00 </ruby> |