Move #to_liquid to Convertible
This commit is contained in:
parent
21de43090a
commit
75d6587d27
|
@ -84,6 +84,16 @@ module Jekyll
|
||||||
raise e
|
raise e
|
||||||
end
|
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
|
# Recursively render layouts
|
||||||
#
|
#
|
||||||
# layouts - a list of the layouts
|
# layouts - a list of the layouts
|
||||||
|
|
|
@ -118,16 +118,6 @@ module Jekyll
|
||||||
do_layout(payload, layouts)
|
do_layout(payload, layouts)
|
||||||
end
|
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
|
# The path to the source file
|
||||||
#
|
#
|
||||||
# Returns the path to the source file
|
# Returns the path to the source file
|
||||||
|
|
|
@ -270,16 +270,6 @@ module Jekyll
|
||||||
path
|
path
|
||||||
end
|
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.
|
# Returns the shorthand String identifier of this Post.
|
||||||
def inspect
|
def inspect
|
||||||
"<Post: #{self.id}>"
|
"<Post: #{self.id}>"
|
||||||
|
|
Loading…
Reference in New Issue