From 6cbe8dab1e64d42eb376137366b48f1e20f9ddb9 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 10 May 2012 02:09:59 -0500 Subject: deleting empty lines in docs parts --- activesupport/lib/active_support/callbacks.rb | 8 -------- 1 file changed, 8 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index cbeba3139a..1972d439ed 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -54,7 +54,6 @@ module ActiveSupport # saving... # - save # saved - # module Callbacks extend Concern @@ -73,7 +72,6 @@ module ActiveSupport # run_callbacks :save do # save # end - # def run_callbacks(kind, key = nil, &block) #TODO: deprecate key argument runner_name = self.class.__define_callbacks(kind, self) @@ -199,7 +197,6 @@ module ActiveSupport # yield self # end # end - # def define_conditional_callback name = "_conditional_callback_#{@kind}_#{next_id}" @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 @@ -253,7 +250,6 @@ module ActiveSupport # Objects:: # a method is created that calls the before_foo method # on the object. - # def _compile_filter(filter) method_name = "_callback_#{@kind}_#{next_id}" case filter @@ -405,7 +401,6 @@ module ActiveSupport # will be called only when it returns a false value. # * :prepend - If true, the callback will be prepended to the existing # chain rather than appended. - # def set_callback(name, *filter_list, &block) mapped = nil @@ -430,7 +425,6 @@ module ActiveSupport # class Writer < Person # skip_callback :validate, :before, :check_membership, :if => lambda { self.age > 18 } # end - # def skip_callback(name, *filter_list, &block) __update_callbacks(name, filter_list, block) do |target, chain, type, filters, options| filters.each do |filter| @@ -449,7 +443,6 @@ module ActiveSupport end # Remove all set callbacks for the given event. - # def reset_callbacks(symbol) callbacks = send("_#{symbol}_callbacks") @@ -530,7 +523,6 @@ module ActiveSupport # define_callbacks :save, :scope => [:name] # # would call Audit#save. - # def define_callbacks(*callbacks) config = callbacks.last.is_a?(Hash) ? callbacks.pop : {} callbacks.each do |callback| -- cgit v1.2.3 From 1065ef8fd3ad499feec01b39292ee435c1f71c13 Mon Sep 17 00:00:00 2001 From: Edward Tsech Date: Fri, 11 May 2012 11:11:41 +0200 Subject: Fix copypaste. [ci skip] --- activesupport/test/core_ext/hash_ext_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 1cd10eb6e2..822fcbc53e 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -491,11 +491,11 @@ class HashExtTest < ActiveSupport::TestCase original = { :a => 'x', :b => 'y', :c => 10 } expected = { :a => 'x', :b => 'y' } - # Should return a new hash with only the given keys. + # Should return a new hash without the given keys. assert_equal expected, original.except(:c) assert_not_equal expected, original - # Should replace the hash with only the given keys. + # Should replace the hash without the given keys. assert_equal expected, original.except!(:c) assert_equal expected, original end -- cgit v1.2.3 From 7ce4ce33c7c3229752c51dd92ca9d758ec452fc1 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 10:51:36 -0500 Subject: added docs to String#at --- .../lib/active_support/core_ext/string/access.rb | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 23aaee9c43..8a922a7069 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -1,6 +1,31 @@ require 'active_support/multibyte' class String + # If you pass a single Fixnum, returns a substring of one character at that + # position. The first character of the string is at position 0, the next at + # position 1, and so on. If a range is supplied, a substring containing + # characters at offsets given by the range is returned. In both cases, if an + # offset is negative, it is counted from the end of the string. Returns nil + # if the initial offset falls outside the string. Returns an empty string if + # the beginning of the range is greater than the end of the string. + # + # str = "hello" + # str.at(0) #=> "h" + # str.at(1..3) #=> "ell" + # str.at(-2) #=> "l" + # str.at(-2..-1) #=> "lo" + # str.at(5) #=> nil + # str.at(5..-1) #=> "" + # + # If a Regexp is given, the matching portion of the string is returned. + # If a String is given, that given string is returned if it occurs in + # the string. In both cases, nil is returned if there is no match. + # + # str = "hello" + # str.at(/lo/) #=> "lo" + # str.at(/ol/) #=> nil + # str.at("lo") #=> "lo" + # str.at("ol") #=> nil def at(position) self[position] end -- cgit v1.2.3 From 315350847f5089fa2b314b00d485e5121f5622d4 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 11:35:26 -0500 Subject: added docs to String#to --- activesupport/lib/active_support/core_ext/string/access.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 8a922a7069..5cdf42ce4b 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -34,6 +34,19 @@ class String self[position..-1] end + # Returns the beginning of the string up to position. If the position is + # negative, it is counted from the end of the string. + # + # str = "hello" + # str.to(0) #=> "h" + # str.to(3) #=> "hell" + # str.to(-2) #=> "hell" + # + # You can mix it with +from+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) #=> "hello" + # str.from(1).to(-2) #=> "ell" def to(position) self[0..position] end -- cgit v1.2.3 From 0822dc01f68eb262274fbedcf97a224e6457ff3b Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 11:41:22 -0500 Subject: improve String#to docs --- activesupport/lib/active_support/core_ext/string/access.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 5cdf42ce4b..9494a9b69d 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -34,8 +34,8 @@ class String self[position..-1] end - # Returns the beginning of the string up to position. If the position is - # negative, it is counted from the end of the string. + # Returns a substring from the beginning of the string to the given position. + # If the position is negative, it is counted from the end of the string. # # str = "hello" # str.to(0) #=> "h" -- cgit v1.2.3 From 07045fa919b4787d8ec458a1594f62cdedaf1b06 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 11:47:40 -0500 Subject: added docs to String#from --- activesupport/lib/active_support/core_ext/string/access.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 9494a9b69d..1436d43be6 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -30,6 +30,19 @@ class String self[position] end + # Returns a substring from the given position to the end of the string. + # If the position is negative, it is counted from the end of the string. + # + # str = "hello" + # str.from(0) #=> "hello" + # str.from(3) #=> "lo" + # str.from(-2) #=> "lo" + # + # You can mix it with +to+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) #=> "hello" + # str.from(1).to(-2) #=> "ell" def from(position) self[position..-1] end -- cgit v1.2.3 From 84784b4f234c0f21096202309805c3c304901baa Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 12:20:57 -0500 Subject: added docs to String#first --- activesupport/lib/active_support/core_ext/string/access.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 1436d43be6..43024fb012 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -64,6 +64,17 @@ class String self[0..position] end + # Returns the first character of the string. If a limit is supplied, + # returns a substring from the beginning of the string to the given + # limit. If the given limit is greater than or equal to the string + # length, returns it self. + # + # str = "hello" + # str.first #=> "h" + # str.first(1) #=> "h" + # str.first(2) #=> "he" + # str.first(0) #=> "" + # str.first(6) #=> "hello" def first(limit = 1) if limit == 0 '' -- cgit v1.2.3 From 074359dfa8d9e16058de4bd6375b2438fef3de83 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 12:24:45 -0500 Subject: fix typo in String#first --- activesupport/lib/active_support/core_ext/string/access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 43024fb012..9bb0c597b2 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -67,7 +67,7 @@ class String # Returns the first character of the string. If a limit is supplied, # returns a substring from the beginning of the string to the given # limit. If the given limit is greater than or equal to the string - # length, returns it self. + # length, returns self. # # str = "hello" # str.first #=> "h" -- cgit v1.2.3 From b2e9d33515eb858507cfab8e15eb4a9e049a433a Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 12:56:53 -0500 Subject: improve String#first docs --- activesupport/lib/active_support/core_ext/string/access.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 9bb0c597b2..baa5b84db6 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -64,10 +64,9 @@ class String self[0..position] end - # Returns the first character of the string. If a limit is supplied, - # returns a substring from the beginning of the string to the given - # limit. If the given limit is greater than or equal to the string - # length, returns self. + # Returns the first character. If a limit is supplied, returns a substring + # from the beginning of the string until it reaches the limit value. If the + # given limit is greater than or equal to the string length, returns self. # # str = "hello" # str.first #=> "h" -- cgit v1.2.3 From ed116eda053e8cccb5dda1c4724f8609eceaa90f Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 13:11:06 -0500 Subject: added docs to String#last --- activesupport/lib/active_support/core_ext/string/access.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index baa5b84db6..76b30b4c19 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -84,6 +84,16 @@ class String end end + # Returns the last character of the string. If a limit is supplied, returns a substring + # from the end of the string until it reaches the limit value (counting backwards). If + # the given limit is greater than or equal to the string length, returns self. + # + # str = "hello" + # str.last #=> "h" + # str.last(1) #=> "h" + # str.last(2) #=> "lo" + # str.last(0) #=> "" + # str.last(6) #=> "hello" def last(limit = 1) if limit == 0 '' -- cgit v1.2.3 From 53ef85dae8081e81f7dbb1f09a6150777f509cd4 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 13:16:35 -0500 Subject: fix String#last example --- activesupport/lib/active_support/core_ext/string/access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 76b30b4c19..2ebfd48818 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -89,7 +89,7 @@ class String # the given limit is greater than or equal to the string length, returns self. # # str = "hello" - # str.last #=> "h" + # str.last #=> "o" # str.last(1) #=> "h" # str.last(2) #=> "lo" # str.last(0) #=> "" -- cgit v1.2.3 From 39c483fec56b98b0cdb11b705cd7e63b43d60a64 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 13:18:00 -0500 Subject: fix String#last example --- activesupport/lib/active_support/core_ext/string/access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 2ebfd48818..5c32a2453d 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -90,7 +90,7 @@ class String # # str = "hello" # str.last #=> "o" - # str.last(1) #=> "h" + # str.last(1) #=> "o" # str.last(2) #=> "lo" # str.last(0) #=> "" # str.last(6) #=> "hello" -- cgit v1.2.3 From ef440bb0c3378a04300c592ec8432d26afc6ad1d Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 16:21:32 -0500 Subject: remove unnecessary 'examples' noise --- activesupport/lib/active_support/core_ext/string/filters.rb | 1 - activesupport/lib/active_support/core_ext/string/inflections.rb | 6 ------ activesupport/lib/active_support/core_ext/string/output_safety.rb | 2 -- 3 files changed, 9 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb index 32a37296d5..2478f42290 100644 --- a/activesupport/lib/active_support/core_ext/string/filters.rb +++ b/activesupport/lib/active_support/core_ext/string/filters.rb @@ -5,7 +5,6 @@ class String # the string, and then changing remaining consecutive whitespace # groups into one space each. # - # Examples: # %{ Multi-line # string }.squish # => "Multi-line string" # " foo bar \n \t boo".squish # => "foo bar boo" diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index 049ffe7986..070bfd7af6 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -13,7 +13,6 @@ class String # the singular form will be returned if count == 1. # For any other value of +count+ the plural will be returned. # - # ==== Examples # 'post'.pluralize # => "posts" # 'octopus'.pluralize # => "octopi" # 'sheep'.pluralize # => "sheep" @@ -46,7 +45,6 @@ class String # in the string. It raises a NameError when the name is not in CamelCase # or is not initialized. See ActiveSupport::Inflector.constantize # - # Examples # 'Module'.constantize # => Module # 'Class'.constantize # => Class # 'blargle'.constantize # => NameError: wrong constant name blargle @@ -58,7 +56,6 @@ class String # in the string. It returns nil when the name is not in CamelCase # or is not initialized. See ActiveSupport::Inflector.safe_constantize # - # Examples # 'Module'.safe_constantize # => Module # 'Class'.safe_constantize # => Class # 'blargle'.safe_constantize # => nil @@ -140,8 +137,6 @@ class String # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. # - # ==== Examples - # # class Person # def to_param # "#{id}-#{name.parameterize}" @@ -194,7 +189,6 @@ class String # +separate_class_name_and_id_with_underscore+ sets whether # the method should put '_' between the name and 'id'. # - # Examples # 'Message'.foreign_key # => "message_id" # 'Message'.foreign_key(false) # => "messageid" # 'Admin::Post'.foreign_key # => "post_id" diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 215ba87ca9..6bda970e40 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -14,7 +14,6 @@ class ERB # In your ERB templates, use this method to escape any unsafe content. For example: # <%=h @person.name %> # - # ==== Example: # puts html_escape('is a > 0 & a < 10?') # # => is a > 0 & a < 10? def html_escape(s) @@ -37,7 +36,6 @@ class ERB # A utility method for escaping HTML without affecting existing escaped entities. # - # ==== Examples # html_escape_once('1 < 2 & 3') # # => "1 < 2 & 3" # -- cgit v1.2.3 From 7bf6edf819adf48b253dce7673ec82cda821646b Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 16:42:23 -0500 Subject: added examples to String#exclude? --- activesupport/lib/active_support/core_ext/string/exclude.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/exclude.rb b/activesupport/lib/active_support/core_ext/string/exclude.rb index 5e184ec1b3..114bcb87f0 100644 --- a/activesupport/lib/active_support/core_ext/string/exclude.rb +++ b/activesupport/lib/active_support/core_ext/string/exclude.rb @@ -1,5 +1,10 @@ class String - # The inverse of String#include?. Returns true if the string does not include the other string. + # The inverse of String#include?. Returns true if the string + # does not include the other string. + # + # "hello".exclude? "lo" #=> false + # "hello".exclude? "ol" #=> true + # "hello".exclude? ?h #=> false def exclude?(string) !include?(string) end -- cgit v1.2.3 From 53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 17:08:31 -0500 Subject: added docs to String#to_date --- activesupport/lib/active_support/core_ext/string/conversions.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index 9084bbee32..c42163a2f0 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -15,6 +15,12 @@ class String end end + # Converts a string to a Date value. + # + # "1-1-2012".to_date #=> Sun, 01 Jan 2012 + # "01/01/2012".to_date #=> Sun, 01 Jan 2012 + # "2012-12-13".to_date #=> Thu, 13 Dec 2012 + # "12/13/2012".to_date #=> ArgumentError: invalid date def to_date unless blank? date_values = ::Date._parse(self, false).values_at(:year, :mon, :mday) -- cgit v1.2.3 From a0b46b5f1b8b554f438dd4efcbd71274c34a5dae Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 17:30:46 -0500 Subject: added docs to String#to_datetime --- activesupport/lib/active_support/core_ext/string/conversions.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index c42163a2f0..050eea33ee 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -29,6 +29,12 @@ class String end end + # Converts a string to a DateTime value. + # + # "1-1-2012".to_datetime #=> Sun, 01 Jan 2012 00:00:00 +0000 + # "01/01/2012 23:59:59".to_datetime #=> Sun, 01 Jan 2012 23:59:59 +0000 + # "2012-12-13 12:50".to_datetime #=> Thu, 13 Dec 2012 12:50:00 +0000 + # "12/13/2012".to_datetime #=> ArgumentError: invalid date def to_datetime unless blank? date_values = ::Date._parse(self, false). -- cgit v1.2.3 From fc6ab69777af21db3afb45de8ae08ffc316e69e9 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 23:02:05 -0500 Subject: removing trailing spaces --- activesupport/lib/active_support/core_ext/string/conversions.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index 050eea33ee..022b376aec 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -17,9 +17,9 @@ class String # Converts a string to a Date value. # - # "1-1-2012".to_date #=> Sun, 01 Jan 2012 - # "01/01/2012".to_date #=> Sun, 01 Jan 2012 - # "2012-12-13".to_date #=> Thu, 13 Dec 2012 + # "1-1-2012".to_date #=> Sun, 01 Jan 2012 + # "01/01/2012".to_date #=> Sun, 01 Jan 2012 + # "2012-12-13".to_date #=> Thu, 13 Dec 2012 # "12/13/2012".to_date #=> ArgumentError: invalid date def to_date unless blank? -- cgit v1.2.3 From c78c29556e3fe338e4f8d27a917765a4f75c9b0d Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 11 May 2012 23:16:44 -0500 Subject: added examples to Integer#multiple_of? --- activesupport/lib/active_support/core_ext/integer/multiple.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb index 8dff217ddc..907a0df723 100644 --- a/activesupport/lib/active_support/core_ext/integer/multiple.rb +++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb @@ -1,5 +1,9 @@ class Integer # Check whether the integer is evenly divisible by the argument. + # + # 0.multiple_of?(0) #=> true + # 5.multiple_of?(5) #=> false + # 10.multiple_of?(2) #=> true def multiple_of?(number) number != 0 ? self % number == 0 : zero? end -- cgit v1.2.3 From 219342b642bb3e965147364fabe6a02a8edea559 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sat, 12 May 2012 13:31:30 +0300 Subject: remove docs related to ruby 1.8 from Array#wrap --- activesupport/lib/active_support/core_ext/array/wrap.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 4834eca8b1..9ea93d7226 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -25,9 +25,6 @@ class Array # Array(:foo => :bar) # => [[:foo, :bar]] # Array.wrap(:foo => :bar) # => [{:foo => :bar}] # - # Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8 - # Array.wrap("foo\nbar") # => ["foo\nbar"] - # # There's also a related idiom that uses the splat operator: # # [*object] -- cgit v1.2.3 From f2af26dc817281b39a11d1f7131824dfbd4f7a76 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 12 May 2012 18:07:26 +0530 Subject: fix incorrect example [ci skip] --- activesupport/lib/active_support/core_ext/integer/multiple.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb index 907a0df723..7c6c2f1ca7 100644 --- a/activesupport/lib/active_support/core_ext/integer/multiple.rb +++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb @@ -2,7 +2,7 @@ class Integer # Check whether the integer is evenly divisible by the argument. # # 0.multiple_of?(0) #=> true - # 5.multiple_of?(5) #=> false + # 6.multiple_of?(5) #=> false # 10.multiple_of?(2) #=> true def multiple_of?(number) number != 0 ? self % number == 0 : zero? -- cgit v1.2.3