Class: JekyllBlocker::PageCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-blocker/page_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PageCollection

Returns a new instance of PageCollection.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jekyll-blocker/page_collection.rb', line 5

def initialize(path)
  paths = Dir[File.join(path, "**", "*.{liquid,html}")].reject do |file|
    file =~ /\A#{File.join(path, '_')}/
  end

  paths.each do |path|
    key = file.sub(/\A#{path}/, '')
    file = Utilities.read_jekyll_file(path)
    @pages[key] = Page.new
  end

end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages.



3
4
5
# File 'lib/jekyll-blocker/page_collection.rb', line 3

def pages
  @pages
end

Instance Method Details

#find(id) ⇒ Object



18
19
20
# File 'lib/jekyll-blocker/page_collection.rb', line 18

def find(id)
  @pages[id.to_s]
end