Class: Kojo::Collection
- Inherits:
-
Object
- Object
- Kojo::Collection
- Defined in:
- lib/kojo/collection.rb
Overview
The Collection class is a wrapper around the Template object. It provides a mechanism for processing an entire directory of templates.
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#import_base ⇒ Object
Returns the value of attribute import_base.
Instance Method Summary collapse
-
#initialize(dir) ⇒ Collection
constructor
A new instance of Collection.
- #render(args = {}, &block) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(dir) ⇒ Collection
Returns a new instance of Collection.
10 11 12 13 |
# File 'lib/kojo/collection.rb', line 10 def initialize(dir) @dir = dir @import_base = dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
7 8 9 |
# File 'lib/kojo/collection.rb', line 7 def dir @dir end |
#import_base ⇒ Object
Returns the value of attribute import_base.
8 9 10 |
# File 'lib/kojo/collection.rb', line 8 def import_base @import_base end |
Instance Method Details
#render(args = {}, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/kojo/collection.rb', line 15 def render(args = {}, &block) files.each do |file| handle file, args, &block end end |
#size ⇒ Object
21 22 23 |
# File 'lib/kojo/collection.rb', line 21 def size files.size end |