Sha256: 1fc0a6678a2738925e778cc4daffedae3107fb37f2c32a99606abe9faf08065c

Contents?: true

Size: 859 Bytes

Versions: 10

Compression:

Stored size: 859 Bytes

Contents

# encoding: UTF-8

module Jekyll
  module Drops
    class SiteDrop < Drop
      extend Forwardable

      mutable false

      def_delegator  :@obj, :site_data, :data
      def_delegators :@obj, :time, :pages, :static_files, :documents,
                            :tags, :categories

      def [](key)
        if @obj.collections.key?(key) && key != "posts"
          @obj.collections[key].docs
        else
          super(key)
        end
      end

      def posts
        @site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
      end

      def html_pages
        @site_html_pages ||= @obj.pages.select { |page| page.html? || page.url.end_with?("/") }
      end

      def collections
        @site_collections ||= @obj.collections.values.map(&:to_liquid)
      end

      private
      def_delegator :@obj, :config, :fallback_data
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
jekyll-3.2.0.pre.beta1 lib/jekyll/drops/site_drop.rb
jekyll-3.1.3 lib/jekyll/drops/site_drop.rb
jekyll-3.1.2 lib/jekyll/drops/site_drop.rb
jekyllplusadmin-1.1.0 lib/jekyll/drops/site_drop.rb
jekyllplusadmin-1.0.0 lib/jekyll/drops/site_drop.rb
jekyll-3.1.1 lib/jekyll/drops/site_drop.rb
jekyll-3.1.0 lib/jekyll/drops/site_drop.rb
jekyll-3.1.0.pre.rc3 lib/jekyll/drops/site_drop.rb
jekyll-3.1.0.pre.rc2 lib/jekyll/drops/site_drop.rb
jekyll-3.1.0.pre.rc1 lib/jekyll/drops/site_drop.rb