5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 12:26:21 +00:00

usar Post#new? que ya sabe cuándo el documento no existe aun

This commit is contained in:
f 2021-05-17 12:43:23 -03:00
parent 64b59bfc4d
commit e19713f5df
2 changed files with 2 additions and 4 deletions

View file

@ -8,7 +8,7 @@ class MetadataDocumentDate < MetadataTemplate
end end
def value_from_document def value_from_document
return nil unless document.path return nil if post.new?
document.date document.date
end end

View file

@ -49,9 +49,7 @@ class Post
public_send(attr)&.value = args[attr] if args.key?(attr) public_send(attr)&.value = args[attr] if args.key?(attr)
end end
# XXX: No usamos Post#read porque a esta altura todavía no sabemos document.read! unless new?
# nada del Document
document.read! if File.exist? document.path
end end
def inspect def inspect