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.



9
10
11
12
# File 'lib/jekyll/readers/collection_reader.rb', line 9

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

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#siteObject (readonly)

Returns the value of attribute site.



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

def site
  @site
end

Instance Method Details

#readObject

Read in all collections specified in the configuration

Returns nothing.



17
18
19
20
21
# File 'lib/jekyll/readers/collection_reader.rb', line 17

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