There is this:
def first(limit = 1)
chars[0..(limit - 1)].to_s
end
but in console when I try it I get:
“test”.first
NoMethodError: undefined method[]' for #<Enumerable::Enumerator: 0x2242b90> from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/core_ext/string/access.rb:43:in
first’
from (irb):1
because it is doing “test”.chars[0…0]
Or am I missing something here?