module Ftpmock::StringUtils
Public Instance Methods
all_present?(*strings)
click to toggle source
# File lib/ftpmock/utils/string_utils.rb, line 7 def all_present?(*strings) strings.all? { |string| present?(string) } end
diff(localfile, path)
click to toggle source
# File lib/ftpmock/utils/string_utils.rb, line 25 def diff(localfile, path) Diffy::Diff.new(localfile.to_s, path.to_s, source: 'files').to_s(:color) end
parameterize(string, separator: '-')
click to toggle source
Inspired by from gems/activesupport-5.2.3 /lib/active_support/inflector/transliterate.rb
# File lib/ftpmock/utils/string_utils.rb, line 19 def parameterize(string, separator: '-') string.to_s .gsub(/[^a-z0-9\-_]+/i, separator) .downcase end
present?(string)
click to toggle source
# File lib/ftpmock/utils/string_utils.rb, line 11 def present?(string) return string.present? if string.respond_to?(:present?) !string.to_s.strip.empty? end