mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-16 09:58:50 +00:00
Move TimeSpanConverter with another Converters
Follow indications : https://github.com/iv-org/invidious/pull/2915#discussion_r811373953
This commit is contained in:
@@ -256,4 +256,18 @@ struct Preferences
|
||||
cookies
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module TimeSpanConverter
|
||||
def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder)
|
||||
return yaml.scalar recode_length_seconds(value.total_seconds.to_i32)
|
||||
end
|
||||
|
||||
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span
|
||||
if node.is_a?(YAML::Nodes::Scalar)
|
||||
return decode_time_span(node.value)
|
||||
else
|
||||
node.raise "Expected scalar, not #{node.class}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user