From a447e82de4049e79dc1002257a1c6d6a660685d6 Mon Sep 17 00:00:00 2001 From: Scott Barron Date: Wed, 8 Feb 2006 03:43:38 +0000 Subject: A more aesthetically pleasing implementation and changelog entry git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3549 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/string/access.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index c1503ab3e3..5d0e0c21aa 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -50,10 +50,9 @@ module ActiveSupport #:nodoc: # "hello".last(2) # => "lo" # "hello".last(10) # => "hello" def last(limit = 1) - return self if self.length < limit - self[(-limit)..-1] + self[(-limit)..-1] || self end end end end -end \ No newline at end of file +end -- cgit v1.2.3