Module: Dokkit::Environment::Helper

Included in:
Basic
Defined in:
lib/dokkit/environment/helpers.rb,
lib/dokkit/environment/helpers/extmap.rb,
lib/dokkit/environment/helpers/fileselection.rb

Overview

Collect helper class that simplify the setup of documentation environment.

Defined Under Namespace

Classes: ExtMap, FileSelection

Instance Method Summary collapse

Instance Method Details

#configure {|ostruct = OpenStruct.new| ... } ⇒ Object

Yields:

  • (ostruct = OpenStruct.new)


19
20
21
22
23
24
25
26
27
# File 'lib/dokkit/environment/helpers.rb', line 19

def configure(&blk)
  
  yield ostruct = OpenStruct.new        
  
  register :configuration do
    OpenStruct.new(default_configuration.merge(ostruct.marshal_dump))
  end
  
end

#extend_document(glob, extension) ⇒ Object



55
56
57
58
59
# File 'lib/dokkit/environment/helpers.rb', line 55

def extend_document(glob, extension)
  FileSelection.new(configuration.document_dir).include(glob).files.each do |document_fn|
    @extmap[document_fn] = extension
  end
end

#select_data {|new_fs = data_fs| ... } ⇒ Object

Yields:

  • (new_fs = data_fs)


42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/dokkit/environment/helpers.rb', line 42

def select_data(&blk)

  yield new_fs = data_fs

  register :data_fs do
    FileSelection.new(configuration.data_dir) do |fs|
      fs.include(*new_fs.includes)
      fs.exclude(*new_fs.excludes)
    end    
  end
  
end

#select_document {|new_fs = document_fs| ... } ⇒ Object

Yields:

  • (new_fs = document_fs)


29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dokkit/environment/helpers.rb', line 29

def select_document(&blk)
  
  yield new_fs = document_fs
          
  register :document_fs do
    FileSelection.new(configuration.document_dir) do |fs|
      fs.include(*new_fs.includes)
      fs.exclude(*new_fs.excludes)
    end
  end
  
end