Sha256: 6252ccb0b4a6ba001c60482e9810a5b430ba47f190f085d171fea30ff48be5ef

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

class String

  def at(position)
    self[position]
  end

  def from(position)
    self[position..-1]
  end

  def to(position)
    self[0..position]
  end

  def first(limit = 1)
    if limit == 0
      ''
    elsif limit >= size
      self
    else
      to(limit - 1)
    end
  end

  def last(limit = 1)
    if limit == 0
      ''
    elsif limit >= size
      self
    else
      from(-limit)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
happy_support-1.0.0 lib/happy_support/core_ext/string/access.rb