Sha256: ade435add045d70254a209d0c60e2863af7b6cfb65df8fc232ecd698476a0626

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

class String
  def naive_split(pattern)
    string = self.dup
    found = []

    while position = string.index(pattern)
      found << string.slice!(0, position)
      string.slice!(0,[pattern.size,1].max)
    end

    found << string
    found
  end

  def tabs_to_spaces!
    gsub!("\t",' ' * Ruco::TAB_SIZE)
  end

  # stub for 1.8
  unless method_defined?(:force_encoding)
    def force_encoding(encoding)
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruco-0.0.27 lib/ruco/core_ext/string.rb