Further consolidation in the Drops.

This commit is contained in:
Parker Moore 2015-12-22 21:33:42 -05:00
parent 4935e85f7c
commit 532bb9e9cb
4 changed files with 11 additions and 19 deletions

View File

@ -10,7 +10,7 @@ module Jekyll
:relative_directory
def to_s
@obj.docs.map(&:to_s).join(' ')
docs.to_s
end
def output

View File

@ -9,10 +9,6 @@ module Jekyll
alias_method :path, :relative_path
def url
@obj.url
end
def collection
@obj.collection.label
end
@ -30,9 +26,7 @@ module Jekyll
end
private
def fallback_data
@obj.data
end
def_delegator :@obj, :data, :fallback_data
end
end

View File

@ -6,10 +6,11 @@ module Jekyll
extend Forwardable
def_delegator :@obj, :site_data, :data
def_delegators :@obj, :time, :pages, :static_files, :documents
def_delegators :@obj, :time, :pages, :static_files, :documents,
:tags, :categories
def [](key)
if !respond_to?(key) && @obj.collections.key?(key)
if @obj.collections.key?(key) && key != "posts"
@obj.collections[key].docs
else
super(key)
@ -24,14 +25,6 @@ module Jekyll
@site_html_pages ||= @obj.pages.select { |page| page.html? || page.url.end_with?("/") }
end
def categories
@site_categories ||= @obj.post_attr_hash('categories')
end
def tags
@site_tags ||= @obj.post_attr_hash('tags')
end
def collections
@site_collections ||= @obj.collections.values.map(&:to_liquid)
end

View File

@ -2,7 +2,7 @@
module Jekyll
module Drops
class UnifiedPayloadDrop < Liquid::Drop
class UnifiedPayloadDrop < ImmutableDrop
attr_accessor :page, :layout, :content, :paginator
attr_accessor :highlighter_prefix, :highlighter_suffix
@ -19,6 +19,11 @@ module Jekyll
@site_drop ||= SiteDrop.new(@site)
end
private
def fallback_data
@fallback_data ||= {}
end
end
end
end