Class: Muwu::Manifest

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/manifest/manifest.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Muwu

debug, read

Constructor Details

#initializeManifest

Returns a new instance of Manifest.



15
16
17
# File 'lib/muwu/manifest/manifest.rb', line 15

def initialize
  @documents = []
end

Instance Attribute Details

#documentsObject

Returns the value of attribute documents.



8
9
10
# File 'lib/muwu/manifest/manifest.rb', line 8

def documents
  @documents
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/muwu/manifest/manifest.rb', line 8

def options
  @options
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/muwu/manifest/manifest.rb', line 8

def project
  @project
end

Instance Method Details

#contents_block_by_name(text_root_name) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/muwu/manifest/manifest.rb', line 34

def contents_block_by_name(text_root_name)
  matching_contents = []
  documents_html.each do |document_html|
    matching_contents << document_html.contents_blocks_by_name(text_root_name)
  end
  matching_contents.flatten[0]
end

#documents_countObject



43
44
45
# File 'lib/muwu/manifest/manifest.rb', line 43

def documents_count
  @documents.length
end

#documents_cssObject



48
49
50
# File 'lib/muwu/manifest/manifest.rb', line 48

def documents_css
  @documents.select { |d| ManifestTask::DocumentCss === d }
end

#documents_css_countObject



53
54
55
# File 'lib/muwu/manifest/manifest.rb', line 53

def documents_css_count
  documents_css.length
end

#documents_htmlObject



58
59
60
# File 'lib/muwu/manifest/manifest.rb', line 58

def documents_html
  @documents.select { |d| ManifestTask::DocumentHtml === d }    
end

#documents_html_countObject



63
64
65
# File 'lib/muwu/manifest/manifest.rb', line 63

def documents_html_count
  documents_html.length
end

#documents_jsObject



68
69
70
# File 'lib/muwu/manifest/manifest.rb', line 68

def documents_js
  @documents.select { |d| ManifestTask::DocumentJs === d }
end

#documents_js_countObject



73
74
75
# File 'lib/muwu/manifest/manifest.rb', line 73

def documents_js_count
  documents_js.length
end

#does_have_documentsObject



78
79
80
# File 'lib/muwu/manifest/manifest.rb', line 78

def does_have_documents
  documents_count > 0
end

#does_have_documents_cssObject



83
84
85
# File 'lib/muwu/manifest/manifest.rb', line 83

def does_have_documents_css
  documents_css_count > 0
end

#does_have_documents_htmlObject



88
89
90
# File 'lib/muwu/manifest/manifest.rb', line 88

def does_have_documents_html
  documents_html_count > 0
end

#does_have_documents_jsObject



93
94
95
# File 'lib/muwu/manifest/manifest.rb', line 93

def does_have_documents_js
  documents_js_count > 0
end

#does_not_have_documentsObject



98
99
100
# File 'lib/muwu/manifest/manifest.rb', line 98

def does_not_have_documents
  documents_count == 0
end

#find_document_html_by_index(index) ⇒ Object



103
104
105
# File 'lib/muwu/manifest/manifest.rb', line 103

def find_document_html_by_index(index)
  documents_html.select { |document_html| document_html.index == index }[0]
end

#inspectObject



20
21
22
# File 'lib/muwu/manifest/manifest.rb', line 20

def inspect
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
end

#inspect_instance_variablesObject



25
26
27
# File 'lib/muwu/manifest/manifest.rb', line 25

def inspect_instance_variables
  self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
end

#text_blocksObject



139
140
141
142
143
144
145
# File 'lib/muwu/manifest/manifest.rb', line 139

def text_blocks
  text_blocks = []
  documents_html.each do |document_html|
    text_blocks.concat(document_html.text_blocks)
  end
  text_blocks.flatten
end

#text_blocks_by_name(text_root_name) ⇒ Object



148
149
150
151
152
153
154
# File 'lib/muwu/manifest/manifest.rb', line 148

def text_blocks_by_name(text_root_name)
  matching_text_blocks = []
  documents_html.each do |document_html|
    matching_text_blocks.concat(document_html.text_blocks_by_name(text_root_name))
  end
  matching_text_blocks.flatten
end