Move #to_liquid to Convertible

This commit is contained in:
maul.esel 2013-07-22 16:34:01 +02:00
parent 21de43090a
commit 75d6587d27
3 changed files with 10 additions and 20 deletions

View File

@ -84,6 +84,16 @@ module Jekyll
raise e
end
# Convert this Convertible's data to a Hash suitable for use by Liquid.
#
# Returns the Hash representation of this Convertible.
def to_liquid
further_data = Hash[self.class::ATTRIBUTES_FOR_LIQUID.map { |attribute|
[attribute, send(attribute)]
}]
data.deep_merge(further_data)
end
# Recursively render layouts
#
# layouts - a list of the layouts

View File

@ -118,16 +118,6 @@ module Jekyll
do_layout(payload, layouts)
end
# Convert this Page's data to a Hash suitable for use by Liquid.
#
# Returns the Hash representation of this Page.
def to_liquid
further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute|
[attribute, send(attribute)]
}]
data.deep_merge(further_data)
end
# The path to the source file
#
# Returns the path to the source file

View File

@ -270,16 +270,6 @@ module Jekyll
path
end
# Convert this post into a Hash for use in Liquid templates.
#
# Returns the representative Hash.
def to_liquid
further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute|
[attribute, send(attribute)]
}]
data.deep_merge(further_data)
end
# Returns the shorthand String identifier of this Post.
def inspect
"<Post: #{self.id}>"