Move #to_liquid to Convertible
This commit is contained in:
parent
21de43090a
commit
75d6587d27
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}>"
|
||||
|
|
Loading…
Reference in New Issue