Class: Specification
- Inherits:
-
PersistentDocument
- Object
- BaseDocument
- PersistentDocument
- Specification
- Defined in:
- lib/almirah/doc_types/specification.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#dictionary ⇒ Object
Returns the value of attribute dictionary.
-
#duplicated_ids_number ⇒ Object
Returns the value of attribute duplicated_ids_number.
-
#duplicates_list ⇒ Object
Returns the value of attribute duplicates_list.
-
#items_with_coverage_number ⇒ Object
Returns the value of attribute items_with_coverage_number.
-
#items_with_downlinks_number ⇒ Object
Returns the value of attribute items_with_downlinks_number.
-
#items_with_uplinks_number ⇒ Object
Returns the value of attribute items_with_uplinks_number.
-
#last_used_id ⇒ Object
Returns the value of attribute last_used_id.
-
#last_used_id_number ⇒ Object
Returns the value of attribute last_used_id_number.
-
#todo_blocks ⇒ Object
Returns the value of attribute todo_blocks.
-
#wrong_links_hash ⇒ Object
Returns the value of attribute wrong_links_hash.
Attributes inherited from PersistentDocument
#controlled_items, #frontmatter, #headings, #items, #path, #up_link_docs
Attributes inherited from BaseDocument
Instance Method Summary collapse
-
#initialize(fele_path) ⇒ Specification
constructor
A new instance of Specification.
- #to_console ⇒ Object
- #to_html(nav_pane, output_file_path) ⇒ Object
Methods inherited from BaseDocument
Constructor Details
#initialize(fele_path) ⇒ Specification
Returns a new instance of Specification.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/almirah/doc_types/specification.rb', line 10 def initialize(fele_path) super @dictionary = {} @duplicates_list = [] @todo_blocks = [] @wrong_links_hash = {} @items_with_uplinks_number = 0 @items_with_downlinks_number = 0 @items_with_coverage_number = 0 @duplicated_ids_number = 0 @last_used_id = '' @last_used_id_number = 0 @color = 'bbb' @id = File.basename(fele_path, File.extname(fele_path)).downcase end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def color @color end |
#dictionary ⇒ Object
Returns the value of attribute dictionary.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def dictionary @dictionary end |
#duplicated_ids_number ⇒ Object
Returns the value of attribute duplicated_ids_number.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def duplicated_ids_number @duplicated_ids_number end |
#duplicates_list ⇒ Object
Returns the value of attribute duplicates_list.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def duplicates_list @duplicates_list end |
#items_with_coverage_number ⇒ Object
Returns the value of attribute items_with_coverage_number.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def items_with_coverage_number @items_with_coverage_number end |
#items_with_downlinks_number ⇒ Object
Returns the value of attribute items_with_downlinks_number.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def items_with_downlinks_number @items_with_downlinks_number end |
#items_with_uplinks_number ⇒ Object
Returns the value of attribute items_with_uplinks_number.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def items_with_uplinks_number @items_with_uplinks_number end |
#last_used_id ⇒ Object
Returns the value of attribute last_used_id.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def last_used_id @last_used_id end |
#last_used_id_number ⇒ Object
Returns the value of attribute last_used_id_number.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def last_used_id_number @last_used_id_number end |
#todo_blocks ⇒ Object
Returns the value of attribute todo_blocks.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def todo_blocks @todo_blocks end |
#wrong_links_hash ⇒ Object
Returns the value of attribute wrong_links_hash.
6 7 8 |
# File 'lib/almirah/doc_types/specification.rb', line 6 def wrong_links_hash @wrong_links_hash end |
Instance Method Details
#to_console ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/almirah/doc_types/specification.rb', line 29 def to_console puts '' puts "\e[33mSpecification: #{@title}\e[0m" puts '-' * 53 puts '| Number of Controlled Items | %10d |' % @controlled_items.length puts format('| Number of Items w/ Up-links | %10d |', @items_with_uplinks_number) puts format('| Number of Items w/ Down-links | %10d |', @items_with_downlinks_number) # coverage if @controlled_items.length.positive? && (@controlled_items.length == @items_with_coverage_number) puts format("| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|", @items_with_coverage_number) else puts format('| Number of Items w/ Test Coverage | %10d |', @items_with_coverage_number) end # duplicates if @duplicated_ids_number.positive? puts format("| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|", @duplicated_ids_number) else puts format('| Duplicated Item Ids found | %10d |', @duplicated_ids_number) end puts format("| Last used Item Id |\e[1m\e[37m %10s \e[0m|", @last_used_id) puts '-' * 53 end |
#to_html(nav_pane, output_file_path) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/almirah/doc_types/specification.rb', line 55 def to_html(nav_pane, output_file_path) html_rows = [] html_rows.append('') @items.each do |item| a = item.to_html html_rows.append a end save_html_to_file(html_rows, nav_pane, output_file_path) end |