Rename for more idiomatic Ruby
This commit is contained in:
parent
4ed41558d1
commit
91f0b91d6a
|
@ -12,7 +12,7 @@ module Jekyll
|
||||||
def group_by(input, property)
|
def group_by(input, property)
|
||||||
if groupable?(input)
|
if groupable?(input)
|
||||||
groups = input.group_by { |item| item_property(item, property).to_s }
|
groups = input.group_by { |item| item_property(item, property).to_s }
|
||||||
make_grouped_array(groups)
|
grouped_array(groups)
|
||||||
else
|
else
|
||||||
input
|
input
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ module Jekyll
|
||||||
@context[variable] = item
|
@context[variable] = item
|
||||||
parsed_expr.render(@context)
|
parsed_expr.render(@context)
|
||||||
end
|
end
|
||||||
make_grouped_array(groups)
|
grouped_array(groups)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def make_grouped_array(groups)
|
def grouped_array(groups)
|
||||||
groups.each_with_object([]) do |item, array|
|
groups.each_with_object([]) do |item, array|
|
||||||
array << {
|
array << {
|
||||||
"name" => item.first,
|
"name" => item.first,
|
||||||
|
|
Loading…
Reference in New Issue