Class: Jekyll::CollectionPages::CollectionConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/collection_pages/collection_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CollectionConfig

Returns a new instance of CollectionConfig.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jekyll/collection_pages/collection_config.rb', line 8

def initialize(config)
  unless config.is_a?(Hash)
    Jekyll.logger.error('CollectionPages:', "Invalid collection config entry: #{config.inspect}.")
    raise ArgumentError, "Invalid collection_pages config entry. #{config.inspect}."
  end
  @collection_name = config['collection']
  @tag_field = config['field']
  @tag_base_path = config['path'] || @collection_name
  @tag_layout = normalize_layout(config['layout'] || 'collection_layout')
  @per_page = normalize_paginate_value(config['paginate'])

  validate_config
end

Instance Attribute Details

#collection_nameObject (readonly)

Returns the value of attribute collection_name.



6
7
8
# File 'lib/jekyll/collection_pages/collection_config.rb', line 6

def collection_name
  @collection_name
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



6
7
8
# File 'lib/jekyll/collection_pages/collection_config.rb', line 6

def per_page
  @per_page
end

#tag_base_pathObject (readonly)

Returns the value of attribute tag_base_path.



6
7
8
# File 'lib/jekyll/collection_pages/collection_config.rb', line 6

def tag_base_path
  @tag_base_path
end

#tag_fieldObject (readonly)

Returns the value of attribute tag_field.



6
7
8
# File 'lib/jekyll/collection_pages/collection_config.rb', line 6

def tag_field
  @tag_field
end

#tag_layoutObject (readonly)

Returns the value of attribute tag_layout.



6
7
8
# File 'lib/jekyll/collection_pages/collection_config.rb', line 6

def tag_layout
  @tag_layout
end