Method: Wgit::Utils.sanitize
- Defined in:
- lib/wgit/utils.rb
.sanitize(obj, encode: true) ⇒ Object
Sanitises the obj to make it uniform by calling the correct sanitize_* method for its type e.g. if obj.is_a? String then sanitize_str(obj) is called. Any type not in the case statement will be ignored and returned as is. Call this method if unsure what obj's type is.
243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/wgit/utils.rb', line 243 def self.sanitize(obj, encode: true) case obj when Wgit::Url sanitize_url(obj, encode:) when String sanitize_str(obj, encode:) when Array sanitize_arr(obj, encode:) else obj end end |