Class: Rakyll::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/rakyll/route.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Route

Returns a new instance of Route.



3
4
5
6
# File 'lib/rakyll/route.rb', line 3

def initialize(opts)
  @opts = opts
  @compilers = []
end

Instance Method Details

#copy(pattern) ⇒ Object



16
17
18
19
20
21
# File 'lib/rakyll/route.rb', line 16

def copy(pattern)
  Dir.glob(pattern).each do |source_filename|
    compiler = Rakyll::Compiler::Copy.new source_filename, @opts
    @compilers.push compiler
  end
end

#create(filename, &block) ⇒ Object



23
24
25
26
27
# File 'lib/rakyll/route.rb', line 23

def create(filename, &block)
  compiler = Rakyll::Compiler::Create.new filename, @opts
  compiler.instance_eval &block
  @compilers.push compiler
end

#match(pattern, &block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/rakyll/route.rb', line 8

def match(pattern, &block)
  Dir.glob(pattern).each do |source_filename|
    compiler = Rakyll::Compiler::Match.new source_filename, @opts
    compiler.instance_eval &block
    @compilers.push compiler
  end
end

#saveObject



29
30
31
32
33
# File 'lib/rakyll/route.rb', line 29

def save
  @compilers.each do |compiler|
    compiler.save
  end
end