Module: RWEB
- Defined in:
- lib/rweb.rb
Overview
The RWEB module is the public interface to the RWEB library and contains the following publicly-accessible symbols:
-
The version of the library (VERSION).
-
The RWEB.tangle function which takes an IO object and returns a string containing the tangled code ready for execution.
-
The RWEB.weave function which takes an IO object and returns a string containing the documentation in the appropriate format.
-
The Generator class, an “abstract class” which forces any document generation to conform to the correct footprint. Any generator for weaving back-ends must inherit from this generic class and must call super in its initialization.
Defined Under Namespace
Classes: Generator
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.tangle(io) ⇒ Object
Tangle an RWEB document and return the code as a string.
-
.weave(io) ⇒ Object
Weave the RWEB document into another format according to directives and return as a string.
Class Method Details
.tangle(io) ⇒ Object
Tangle an RWEB document and return the code as a string.
287 288 289 290 291 292 293 294 295 |
# File 'lib/rweb.rb', line 287 def RWEB.tangle(io) directives, docs, chunks = disassemble(io.readlines) raise RuntimeError, "no mainline chunk found in file"\ unless chunks.has_key?("") "# #{directives[:title]}\n"\ "# #{"=" * directives[:title].length}\n\n"\ + (chunks[""], chunks).to_s end |
.weave(io) ⇒ Object
Weave the RWEB document into another format according to directives and return as a string.
299 300 301 302 |
# File 'lib/rweb.rb', line 299 def RWEB.weave(io) directives, docs, chunks = disassemble(io.readlines) eval "Document.new(#{directives[:style]}Generator.new(docs, directives)).to_s" end |