Class: String

Inherits:
Object show all
Defined in:
lib/rant/archive/rubyzip/stdrubyext.rb,
lib/rant/init.rb

Overview

:nodoc:all

Instance Method Summary collapse

Instance Method Details

#_rant_sub_ext(ext, new_ext = nil) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/rant/init.rb', line 49

def _rant_sub_ext(ext, new_ext = nil)
    if new_ext
        self.sub(/#{Regexp.escape ext}$/, new_ext)
    else
        self.sub(/(\.[^.]*$)|$/, ".#{ext}")
    end
end

#ends_with(aString) ⇒ Object



43
44
45
# File 'lib/rant/archive/rubyzip/stdrubyext.rb', line 43

def ends_with(aString)
  index(aString, -aString.size)
end

#ensure_end(aString) ⇒ Object



47
48
49
# File 'lib/rant/archive/rubyzip/stdrubyext.rb', line 47

def ensure_end(aString)
  ends_with(aString) ? self : self + aString
end

#lchopObject



51
52
53
# File 'lib/rant/archive/rubyzip/stdrubyext.rb', line 51

def lchop
  slice(1, length)
end

#starts_with(aString) ⇒ Object



39
40
41
# File 'lib/rant/archive/rubyzip/stdrubyext.rb', line 39

def starts_with(aString)
  rindex(aString, 0) == 0
end