module Mclone::Refinements
Public Instance Methods
escape()
click to toggle source
# File lib/mclone.rb, line 45 def escape Mclone.windows? && %r![^\w\-\=\\\/:]!.match?(self) ? %("#{self}") : shellescape end
extract(*args)
click to toggle source
Same as dig but raises KeyError exception on any non-existent key
# File lib/mclone.rb, line 27 def extract(*args) case args.size when 0 then raise(KeyError, 'non-empty key sequence expected') when 1 then fetch(args.first) else fetch(args.shift).extract(*args) end end
resolve(partial)
click to toggle source
Return a list of items which fully or partially match the specified pattern
# File lib/mclone.rb, line 38 def resolve(partial) rx = Regexp.new(partial) collect { |item| rx.match?(item.to_s) ? item : nil }.compact end