Module: KernelDocs

Included in:
Kernel
Defined in:
dragon/kernel_docs.rb

Overview

Copyright 2019 DragonRuby LLC MIT License kernel_docs.rb has been released under MIT (*only this file*).

Instance Method Summary collapse

Instance Method Details

#docs_classObject


11
12
13
14
15
16
17
18
19
# File 'dragon/kernel_docs.rb', line 11

def docs_class
  <<-S
* DOCS: ~Kernel~

Kernel in the DragonRuby Runtime has patches for how standard out is handled and also
contains a unit of time in games called a tick.

S
end

#docs_export_docs!Object


39
40
41
42
43
44
45
46
# File 'dragon/kernel_docs.rb', line 39

def docs_export_docs!
  <<-S
* DOCS: ~Kernel::export_docs!~

Exports all GTK documentation to txt files and saves them to a docs directory.

S
end

#docs_global_tick_countObject


30
31
32
33
34
35
36
37
# File 'dragon/kernel_docs.rb', line 30

def docs_global_tick_count
  <<-S
* DOCS: ~Kernel::global_tick_count~

Returns the current tick of the application from the point it was started. This value is never reset.

S
end

#docs_method_sort_orderObject


7
8
9
# File 'dragon/kernel_docs.rb', line 7

def docs_method_sort_order
  [:docs_class, :docs_tick_count, :docs_global_tick_count]
end

#docs_tick_countObject


21
22
23
24
25
26
27
28
# File 'dragon/kernel_docs.rb', line 21

def docs_tick_count
  <<-S
* DOCS: ~Kernel::tick_count~

Returns the current tick of the game. This value is reset if you call $gtk.reset.

S
end

#export_docs!Object


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'dragon/kernel_docs.rb', line 48

def export_docs!
  DocsOrganizer.sort_docs_classes!
  final_string = ""
  $docs_classes.each do |k|
    log "* INFO: Retrieving docs for #{k.name}."
    final_string += k.docs_all
  end

  final_string += "\n" + (($gtk.read_file "docs/source.txt") || "")

  html_parse_result = (__docs_to_html__ final_string)

  $gtk.write_file_root 'docs/docs.txt', "#{final_string}"
  $gtk.write_file_root 'docs/docs.html', html_parse_result[:html]
  $gtk.write_file_root 'docs/parse_log.txt', (html_parse_result[:parse_log].join "\n")

  log "* INFO: All docs have been exported to docs/docs.txt."
  log "* INFO: All docs have been exported to docs/docs.html."

  nil
end