class Nineteen::Eighty::Two::Formats::Text

Public Class Methods

format(text, options = {}) click to toggle source
# File lib/nineteen/eighty/two/formatters/text_formatter.rb, line 6
def self.format text, options = {}
  on = options.fetch(:on, '1')
  off = options.fetch(:off, '0')

  Spectrum[*text].map do |t|
    t.join
  end.join("\n").
      gsub('0', off).
      gsub('1', on)
end