Class: JekyllBlocker::PageCollection
- Inherits:
-
Object
- Object
- JekyllBlocker::PageCollection
- Defined in:
- lib/jekyll-blocker/page_collection.rb
Instance Attribute Summary collapse
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
Instance Method Summary collapse
- #find(id) ⇒ Object
-
#initialize(path) ⇒ PageCollection
constructor
A new instance of PageCollection.
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
#pages ⇒ Object (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 |