class Rugments::Formatter
A Formatter takes a token stream and formats it for human viewing.
Constants
- REGISTRY
Public Class Methods
find(tag)
click to toggle source
Find a formatter class given a unique tag.
# File lib/rugments/formatter.rb, line 16 def self.find(tag) REGISTRY[tag] end
format(tokens, opts = {}, &b)
click to toggle source
Format a token stream. Delegates to {#format}.
# File lib/rugments/formatter.rb, line 21 def self.format(tokens, opts = {}, &b) new(opts).format(tokens, &b) end
tag(tag = nil)
click to toggle source
Specify or get the unique tag for this formatter. This is used for specifying a formatter in `rougify`.
# File lib/rugments/formatter.rb, line 8 def self.tag(tag = nil) return @tag unless tag REGISTRY[tag] = self @tag = tag end