From 9754debb9a72f9385950e5282f3642b995ab76d8 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 23:50:32 +0100 Subject: AS guide: removes docs for String#start_with? and String#end_with?, no longer in AS --- .../source/active_support_core_extensions.textile | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 40ba47068d..81b6894f74 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -635,31 +635,15 @@ In Ruby 1.9 the % string operator supports key-based interpolation, bot Active Support adds that functionality to % in previous versions of Ruby. -h4. +start_with?+ and +end_width?+ +h4. +starts_with?+ and +ends_width?+ -Ruby 1.8.7 and up define the predicates +String#start_with?+ and +String#end_with?+: - - -"foo".start_with?("f") # => true -"foo".start_with?("g") # => false -"foo".start_with?("") # => true - -"foo".end_with?("o") # => true -"foo".end_with?("p") # => false -"foo".end_with?("") # => true - - -If strings do not respond to those methods Active Support emulates them, and also defines their 3rd person aliases: +Active Support defines 3rd person aliases of +String#start_with?+ and +String#end_with?+: "foo".starts_with?("f") # => true "foo".ends_with?("o") # => true -in case you feel more comfortable spelling them that way. - -WARNING. Active Support invokes +to_s+ on the argument, but Ruby does not. Since Active Support defines these methods only if strings do not respond to them, this corner of their behaviour depends on the interpreter that runs a given Rails application. You change the interpreter, and +start_with?(1)+ may change its return value. In consequence, it's more portable not to rely on that and pass always strings. - h4. Access h5. +at(position)+ -- cgit v1.2.3