Class: Adocsite::ContentLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/adocsite/content_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContentLoader

Returns a new instance of ContentLoader.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/adocsite/content_loader.rb', line 4

def initialize
  @adoc_options = {:attributes => {
    "imagesdir" => Adocsite::config[:IMAGES_FOLDER],
    "stylesdir" => Adocsite::config[:STYLES_FOLDER],
    "iconsdir" => Adocsite::config[:IMAGES_FOLDER] + "/icons"
    }}

  # files to copy
  @styles = Array.new
  @scripts = Array.new
  @images = Array.new
  @files = Array.new

  #content
  @pages = Hash.new
  @articles = Hash.new
end

Instance Attribute Details

#articlesObject (readonly)

Returns the value of attribute articles.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def articles
  @articles
end

#filesObject (readonly)

Returns the value of attribute files.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def files
  @files
end

#imagesObject (readonly)

Returns the value of attribute images.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def images
  @images
end

#pagesObject (readonly)

Returns the value of attribute pages.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def pages
  @pages
end

#scriptsObject (readonly)

Returns the value of attribute scripts.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def scripts
  @scripts
end

#stylesObject (readonly)

Returns the value of attribute styles.



3
4
5
# File 'lib/adocsite/content_loader.rb', line 3

def styles
  @styles
end

Instance Method Details

#load_assetsObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/adocsite/content_loader.rb', line 30

def load_assets
  all_files = find_all_files

  @content = all_files.select {|path| path.end_with?(*Adocsite::config[:DOCUMENTS])}

  @styles = all_files.select {|path| path.end_with?(*Adocsite::config[:STYLES])}
  @scripts = all_files.select {|path| path.end_with?(*Adocsite::config[:SCRIPTS])}
  @images = all_files.select {|path| path.end_with?(*Adocsite::config[:IMAGES])}
  @files = all_files - @images - @scripts - @styles - @content

  build_pages_and_articles
end