Class: Usmu::Collections
- Inherits:
-
Object
- Object
- Usmu::Collections
- Defined in:
- lib/usmu/collections.rb
Defined Under Namespace
Classes: Collection
Instance Method Summary collapse
- #[](index) ⇒ void
-
#initialize(generator) ⇒ Collections
constructor
A new instance of Collections.
- #refresh ⇒ void
Constructor Details
#initialize(generator) ⇒ Collections
Returns a new instance of Collections.
5 6 7 8 |
# File 'lib/usmu/collections.rb', line 5 def initialize(generator) @generator = generator refresh end |
Instance Method Details
#[](index) ⇒ void
10 11 12 13 14 15 16 17 |
# File 'lib/usmu/collections.rb', line 10 def [](index) unless @collections[index] files = @generator.renderables.select {|r| r['collection'] == index }.sort_by &:date @collections[index] = Collection.new(files) end @collections[index] end |
#refresh ⇒ void
19 20 21 |
# File 'lib/usmu/collections.rb', line 19 def refresh @collections = {} end |