|
|
@ -259,15 +259,15 @@ struct Preferences
|
|
|
|
|
|
|
|
|
|
|
|
module TimeSpanConverter
|
|
|
|
module TimeSpanConverter
|
|
|
|
def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder)
|
|
|
|
def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder)
|
|
|
|
return yaml.scalar recode_length_seconds(value.total_seconds.to_i32)
|
|
|
|
return yaml.scalar value.total_minutes.to_i32
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span
|
|
|
|
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span
|
|
|
|
if node.is_a?(YAML::Nodes::Scalar)
|
|
|
|
if node.is_a?(YAML::Nodes::Scalar)
|
|
|
|
return decode_time_span(node.value)
|
|
|
|
return decode_interval(node.value)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
node.raise "Expected scalar, not #{node.class}"
|
|
|
|
node.raise "Expected scalar, not #{node.class}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|