diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_support_overview.textile | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile index b847e3b742..8e53672abd 100644 --- a/railties/guides/source/active_support_overview.textile +++ b/railties/guides/source/active_support_overview.textile @@ -772,6 +772,14 @@ Returns the substring of the string up to position +position+: "hello".to(10) # => "hello" </ruby> +h5. +first(limit = 1)+ + +The call +str.first(n)+ is equivalent to +str.to(n-1)+ if +n+ > 0, and returns an empty string for +n+ == 0. + +h5. +last(limit = 1)+ + +The call +str.last(n)+ is equivalent to +str.from(-n)+ if +n+ > 0, and returns an empty string for +n+ == 0. + h3. Extensions to +Numeric+ ... |