lib/rext/string/helpers.rb in visionmedia-rext-0.0.4 vs lib/rext/string/helpers.rb in visionmedia-rext-0.0.5

- old
+ new

@@ -128,26 +128,26 @@ ## # Check if a string starts with another +string+. # # === Examples # - # 'foo bar'.start_with? 'foo' # => true + # 'foo bar'.starts_with? 'foo' # => true # - def start_with? string + def starts_with? string index(string) == 0 end ## # Check if a string ends with another +string+. # # === Examples # - # 'foo bar'.end_with? 'bar' # => true + # 'foo bar'.ends_with? 'bar' # => true # - def end_with? string + def ends_with? string rindex(string) == length - string.length end ## # Determines if a string is plural. @@ -170,10 +170,10 @@ # 'cookies'.singular? # => false # 'cookie'.singular? # => true # def singular? - !plural? + not plural? end ## # First +n+ character(s). #