When
resp = sendcmd("MDTM #{filename}")
returns something different than 213. (E.g., 550 Not a plain file, 502 Command not implemented)
Then the method mdtm
def mdtm(filename)
resp = sendcmd("MDTM #{filename}")
if resp.start_with?("213")
return get_body(resp)
end
#
end
will return nil
and then the method mtime:
def mtime(filename, local = false)
return TIME_PARSER.(mdtm(filename), local)
end
will raise an undefined method 'size' for nil (NoMethodError) on the TIME_PARSER, because value is nil
value = value[0, 97] + "..." if value.size > 100
Easy fix:
def mtime(filename, local = false)
value = mdtm(filename)
TIME_PARSER.(value, local) if value
end