26 lines
481 B
Ruby
26 lines
481 B
Ruby
class String
|
|
def with_wrapped_whitespace
|
|
self.gsub(/\s+/, '\ ')
|
|
end
|
|
|
|
def filter_allowed_symbol_into_path
|
|
self.gsub!(/[^0-9A-Za-z \-+.\/]/, '')
|
|
end
|
|
|
|
def true?
|
|
self.to_s.downcase == "true"
|
|
end
|
|
|
|
def add_back_to_path(count)
|
|
string = self
|
|
count.to_i.times { |i|
|
|
string = '../' + string
|
|
}
|
|
return string
|
|
end
|
|
|
|
def nilOrEmpty?
|
|
self.nil? or self.empty?
|
|
end
|
|
end
|