Module CoreEx::String
In: lib/core_ex/string.rb

Methods

head_cut!   import!   rec_fold   to_path   to_proc   to_uri   to_url   width  

Public Instance methods

Provide an helper to cut strings.

Example:

 puts "
   |        A very complex
   |            string
   |  with a specific indentation.
   |
   |I prefer that instead of a HERE doc
   |  because I keep my indentation.
   |".head_cut!

[Source]

# File lib/core_ex/string.rb, line 24
    def head_cut! ( sep='\|' )
      gsub!(/^\s*#{sep}/, '')
      self
    end

[Source]

# File lib/core_ex/string.rb, line 29
    def import!
      to_path.import!
    end

[Source]

# File lib/core_ex/string.rb, line 46
    def rec_fold ( init, &block )
      if include? "\n"
        super
      else
        block[init, self]
      end
    end

[Source]

# File lib/core_ex/string.rb, line 33
    def to_path
      ::Pathname.new(self)
    end

[Source]

# File lib/core_ex/string.rb, line 42
    def to_proc
      DumpableProc.new(self)
    end

[Source]

# File lib/core_ex/string.rb, line 37
    def to_uri
      URI.parse(self)
    end
to_url()

Alias for to_uri

[Source]

# File lib/core_ex/string.rb, line 54
    def width
      size + count("\t") * 7 # TABWIDTH(8) - 1
    end

[Validate]