Class: BitClust::RDCompiler

Inherits:
Object show all
Includes:
HTMLUtils, RbsSignatures, TextUtils, Translatable, VersionBadges
Defined in:
lib/bitclust/rdcompiler.rb

Overview

Compiles doc into HTML.

Direct Known Subclasses

MDCompiler

Constant Summary

Constants included from VersionBadges

VersionBadges::SINCE_CATALOG_KEY, VersionBadges::SINCE_CSS_CLASS, VersionBadges::UNTIL_CATALOG_KEY, VersionBadges::UNTIL_CSS_CLASS

Constants included from TextUtils

TextUtils::INDENT_RE

Constants included from NameUtils

NameUtils::CHAR_TO_MARK, NameUtils::CHAR_TO_NAME, NameUtils::CLASS_NAME_RE, NameUtils::CLASS_PATH_RE, NameUtils::CONST_PATH_RE, NameUtils::CONST_RE, NameUtils::GVAR_RE, NameUtils::LIBNAME_RE, NameUtils::MARK_TO_CHAR, NameUtils::MARK_TO_NAME, NameUtils::METHOD_NAME_RE, NameUtils::METHOD_SPEC_RE, NameUtils::MID, NameUtils::NAME_TO_CHAR, NameUtils::NAME_TO_MARK, NameUtils::TYPEMARK_RE

Instance Method Summary collapse

Methods included from RbsSignatures

#prepare_rbs_signatures, #rbs_signature_dts_for_chunk, #reset_rbs_signatures

Methods included from VersionBadges

#heading_version_badges, #row_version_badges

Methods included from TextUtils

detab, n_indent, n_minimum_indent, unindent, unindent_block

Methods included from NameUtils

build_method_id, classid2name, classname2id, classname?, decodeid, decodename_fs, decodename_url, display_typemark, encodeid, encodename_fs, encodename_rdocurl, encodename_url, functionname?, gvarname?, html_filename, libid2name, libname2id, libname?, method_spec?, methodid2classid, methodid2libid, methodid2mname, methodid2specparts, methodid2specstring, methodid2typechar, methodid2typemark, methodid2typename, methodname?, split_method_id, split_method_spec, typechar2mark, typechar2name, typechar?, typemark2char, typemark2name, typemark?, typename2char, typename2mark, typename?

Constructor Details

#initialize(urlmapper, hlevel = 1, opt = {}) ⇒ RDCompiler

Returns a new instance of RDCompiler.



33
34
35
36
37
38
39
40
41
# File 'lib/bitclust/rdcompiler.rb', line 33

def initialize(urlmapper, hlevel = 1, opt = {})
  @urlmapper = urlmapper
  @catalog = opt[:catalog]
  @hlevel = hlevel
  @type = nil
  @method = nil
  @option = opt.dup
  init_message_catalog(@catalog || MessageCatalog.new({}, 'C'))
end

Instance Method Details

#compile(src) ⇒ Object



43
44
45
46
47
# File 'lib/bitclust/rdcompiler.rb', line 43

def compile(src)
  setup(src) {
    library_file
  }
end

#compile_function(f, opt = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/bitclust/rdcompiler.rb', line 49

def compile_function(f, opt = nil)
  @opt = opt
  @type = :function
  setup(f.source, f) {
    entry
  }
ensure
  @opt = nil
end

#compile_method(m, opt = nil) ⇒ Object

FIXME



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/bitclust/rdcompiler.rb', line 60

def compile_method(m, opt = nil)
  @opt = opt
  @type = :method
  @method = m
  source = m.source
  setup(source, m) {
    prepare_rbs_signatures(m, source)
    entry
  }
ensure
  @opt = nil
end