Class: Jekyll::CollectionReader

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/readers/collection_reader.rb

Constant Summary collapse

SPECIAL_COLLECTIONS =
%w(posts data).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ CollectionReader

Returns a new instance of CollectionReader.



6
7
8
9
# File 'lib/jekyll/readers/collection_reader.rb', line 6

def initialize(site)
  @site = site
  @content = {}
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/jekyll/readers/collection_reader.rb', line 5

def content
  @content
end

#siteObject (readonly)

Returns the value of attribute site.



5
6
7
# File 'lib/jekyll/readers/collection_reader.rb', line 5

def site
  @site
end

Instance Method Details

#readObject

Read in all collections specified in the configuration

Returns nothing.



14
15
16
17
18
# File 'lib/jekyll/readers/collection_reader.rb', line 14

def read
  site.collections.each do |_, collection|
    collection.read unless SPECIAL_COLLECTIONS.include?(collection.label)
  end
end