From ecf44311eacb88ed88f0846cd5c67dcb7300fb04 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 6 Oct 2023 09:57:44 -0300 Subject: [PATCH] feat: obtener el post a partir del post indexado --- app/models/indexed_post.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/models/indexed_post.rb b/app/models/indexed_post.rb index 5c4b151e..44a970c3 100644 --- a/app/models/indexed_post.rb +++ b/app/models/indexed_post.rb @@ -57,6 +57,22 @@ class IndexedPost < ApplicationRecord @document ||= Jekyll::Document.new(full_path, site: site.jekyll, collection: collection) end + # El Post + # + # @todo Decidir qué pasa si el archivo ya no existe + # @return [Post] + def post + @post ||= Post.new(document: document, site: site, layout: schema) + end + + # Devuelve el esquema de datos + # + # @todo Renombrar + # @return [Layout] + def schema + site.layouts[layout.to_sym] + end + # Convertir locale a direccionario de PG # # @param [String,Symbol]