Module: Giblish
- Defined in:
- lib/giblish/utils.rb,
lib/giblish.rb,
lib/giblish/docid.rb,
lib/giblish/gititf.rb,
lib/giblish/version.rb,
lib/giblish/application.rb
Overview
Public: Contains a number of generic utility methods.
Defined Under Namespace
Classes: Application, DocidCollector, GitItf, PathManager
Constant Summary collapse
- VERSION =
"0.2.11".freeze
Class Method Summary collapse
- .application ⇒ Object
-
.register_extensions ⇒ Object
Helper method to register the docid preprocessor extension with the asciidoctor engine.
- .to_valid_id(input_str) ⇒ Object
- .with_captured_stderr ⇒ Object
Class Method Details
.application ⇒ Object
14 15 16 |
# File 'lib/giblish.rb', line 14 def application @application ||= Giblish::Application.new end |
.register_extensions ⇒ Object
Helper method to register the docid preprocessor extension with the asciidoctor engine.
157 158 159 160 161 |
# File 'lib/giblish/docid.rb', line 157 def register_extensions Asciidoctor::Extensions.register do preprocessor DocidCollector end end |
.to_valid_id(input_str) ⇒ Object
163 164 165 166 |
# File 'lib/giblish/utils.rb', line 163 def to_valid_id(input_str) id_str = "_#{input_str.downcase}" id_str.gsub(%r{[^a-z0-9]+},"_") end |
.with_captured_stderr ⇒ Object
153 154 155 156 157 158 159 160 |
# File 'lib/giblish/utils.rb', line 153 def with_captured_stderr old_stderr = $stderr $stderr = StringIO.new("", "w") yield $stderr.string ensure $stderr = old_stderr end |