Sha256: 6871cca79374d2aa535feb24383f8c54b74b657fddda7f70b761e2cee40ea01e

Contents?: true

Size: 752 Bytes

Versions: 8

Compression:

Stored size: 752 Bytes

Contents

# encoding: utf-8

# extend class String with a `prepend` method
class String
    if RUBY_VERSION =~ /^1\.8/
        def prepend(value)
            insert(0, value)
        end
    end

    def starts_with?(prefix)
        prefix = prefix.to_s
        self[0, prefix.length] == prefix
    end

    def double_delimiters
        gsub('\\', '\\\\\\')
    end

    def double_delimiters!
        replace(self.double_delimiters)
    end

    def dos2unix_separator
        gsub('\\', '/')
    end

    def unix2dos_separator
        gsub('/', '\\')
    end

    def dos2unix_separator!
        replace(self.dos2unix_separator)
    end

    def unix2dos_separator!
        replace(self.unix2dos_separator)
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rake-delphi-0.0.34 lib/rake/helpers/string.rb
rake-delphi-0.0.33 lib/rake/helpers/string.rb
rake-delphi-0.0.32 lib/rake/helpers/string.rb
rake-delphi-0.0.31 lib/rake/helpers/string.rb
rake-delphi-0.0.29 lib/rake/helpers/string.rb
rake-delphi-0.0.30 lib/rake/helpers/string.rb
rake-delphi-0.0.28 lib/rake/helpers/string.rb
rake-delphi-0.0.27 lib/rake/helpers/string.rb