class OutputBuilder

Direct Known Subclasses

Defined in:

models/output_builder.cr

Constant Summary

ANSI_ESCAPE = /\e\[[0-?]*[ -\/]*[@-~]|\e\][^\a\e]*(?:\a|\e\\)|\e[ -\/]*[0-~]/

Escape sequences removed on the way into the -o file. Colorize only ever emits the SGR form (\e[…m), but the text being colorized comes out of the scanned repo, so the pattern covers the rest of the escape space too — a route or param string carrying \e[2J, \e[?1049h, \ec or an OSC-8 hyperlink would otherwise be replayed by the terminal of whoever cats the report. Three alternatives, matched in order: CSI (parameter bytes, intermediate bytes, then a final byte in @~), OSC (terminated by BEL or ST), and every other escape — optional intermediates and one final byte. CSI and OSC come first so their introducers aren't consumed as a bare two-character escape.

INLINE_QUERY = /\?([^?\/#]*=[^?#]*)/

A ? in a Noir URL is not always a query separator — it is also route syntax (Express /geo/:ip?, F# /legacy(/?), a regex route /grp/(?:a|b)/(.*)?). Only a ? that introduces a key=value pair before the next path separator opens a query string. Shared by #bake_endpoint, which appends to a URL, and the builders that take one apart, so the two can never disagree about where the route ends.

ROUTE_AUTHORITY = /\A[a-z][a-z0-9+.\-]*:\/\/[^\/]*/i

scheme://authority at the head of an absolute endpoint URL.

Constructors

Instance Method Summary

Constructor Detail

def self.new(options : Hash(String, YAML::Any)) #

[View source]

Instance Method Detail

def bake_endpoint(url : String, params : Array(Param)) #

The block form of NoirLogger#debug, not the String one: #bake_endpoint runs once per endpoint for most builders, and the String overload would build all seven of these messages on every call only for the logger to drop them with debug off.


[View source]
def io : IO #

[View source]
def io=(io : IO) #

[View source]
def logger : NoirLogger #

[View source]
def ob_puts(message) #

[View source]
def output_file : String #

[View source]
def print #

[View source]