/usr/lib/ruby/vendor_ruby/rugments/formatter.rb is in ruby-rugments 1.0.0~beta8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | module Rugments
# A Formatter takes a token stream and formats it for human viewing.
class Formatter
REGISTRY = {}
# Specify or get the unique tag for this formatter. This is used
# for specifying a formatter in `rougify`.
def self.tag(tag = nil)
return @tag unless tag
REGISTRY[tag] = self
@tag = tag
end
# Find a formatter class given a unique tag.
def self.find(tag)
REGISTRY[tag]
end
# Format a token stream. Delegates to {#format}.
def self.format(tokens, opts = {}, &b)
new(opts).format(tokens, &b)
end
end
end
require_relative 'formatters/html'
require_relative 'formatters/terminal256'
require_relative 'formatters/null'
|