# module ExtendedString

### Public Instance Methods

addslashes() click to toggle source

    # File lib/wikicloth/core_ext.rb, line 43
    def addslashes
      self.gsub(/['"\\\x0]/,'\\\\\0');
    end

auto_link() click to toggle source

    # File lib/wikicloth/core_ext.rb, line 51
    def auto_link
      Rinku.auto_link(to_s)
    end

blank?() click to toggle source

    # File lib/wikicloth/core_ext.rb, line 39
    def blank?
      respond_to?(:empty?) ? empty? : !self
    end

dump() click to toggle source

    # File lib/wikicloth/core_ext.rb, line 59
    def dump()
      ret = to_s
      delete!(to_s)
      ret
    end

last(n) click to toggle source

    # File lib/wikicloth/core_ext.rb, line 55
    def last(n)
      self[-n,n]
    end

smart_split(char) click to toggle source

    # File lib/wikicloth/core_ext.rb, line 65
    def smart_split(char)
      ret = []
      tmp = ""
      inside = 0
      to_s.each_char do |x|
        if x == char && inside == 0
          ret << tmp
          tmp = ""
        else
          inside += 1 if x == "[" || x == "{" || x == "<"
          inside -= 1 if x == "]" || x == "}" || x == ">"
          tmp += x
        end
      end
      ret << tmp unless tmp.empty?
      ret
    end

to_slug() click to toggle source

    # File lib/wikicloth/core_ext.rb, line 47
    def to_slug
      self.gsub(/\W+/, '-').gsub(/^-+/,'').gsub(/-+$/,'').downcase
    end