Sha256: e289e7ab081ea1a6eaaec7e9a214d2b1f61c4f0932167840225a55cb506bb704

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

module Repper
  module Format
    # A structured format with colorization.
    Structured = ->(tokens, theme) do
      table = Tabulo::Table.new(tokens.reject(&:whitespace?), **TABULO_STYLE)
      table.add_column(
        :indented_text,
        styler: ->(_, string, cell) { theme.colorize(string, cell.source.type) }
      )
      table.pack.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repper-1.1.0 lib/repper/format/structured.rb