Class: Kojo::Collection

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#dirObject (readonly)

Returns the value of attribute dir.



7
8
9
# File 'lib/kojo/collection.rb', line 7

def dir
  @dir
end

#import_baseObject

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

#sizeObject



21
22
23
# File 'lib/kojo/collection.rb', line 21

def size
  files.size
end