YandexDisk::Parse
Parsers for the human-friendly scalars accepted in the config file.
Constants
SIZE_PATTERN = /\A\s*(\d+(?:\.\d+)?)\s*([a-zA-Z]*)\s*\z/
SIZE_UNITS = {"" => 1_i64, "b" => 1_i64, "k" => 1024_i64, "kb" => 1024_i64, "kib" => 1024_i64, "m" => 1024_i64 ** 2, "mb" => 1024_i64 ** 2, "mib" => 1024_i64 ** 2, "g" => 1024_i64 ** 3, "gb" => 1024_i64 ** 3, "gib" => 1024_i64 ** 3, "t" => 1024_i64 ** 4, "tb" => 1024_i64 ** 4, "tib" => 1024_i64 ** 4}
TIME_PATTERN = /\A\s*(\d+(?:\.\d+)?)\s*([a-zA-Z]*)\s*\z/
TIME_UNITS = {"ms" => 1.millisecond, "s" => 1.second, "m" => 1.minute, "h" => 1.hour, "d" => 1.day}
Class methods
"16MB" => 16777216. Units are binary (KiB), bare numbers are bytes.