Sha256: 7e3dbf903264b0bea0628132e045e3d64095b7d535582fc8f15f2182de579ff4
Contents?: true
Size: 685 Bytes
Versions: 4
Compression:
Stored size: 685 Bytes
Contents
module Nineteen module Eighty module Two class Spectrum CHARACTERS = YAML.load_file File.join File.dirname(__FILE__), '..', '..', '..', '..', 'config', 'characters.yml' def self.[] text Spectrum.linify text.chars.map { |c| Spectrum.get(c) } end def self.get key key = ' ' unless CHARACTERS[key] CHARACTERS[key].map { |b| Spectrum.bits(b) } end def self.bits number (0..7).map do |i| number[i] end.reverse end def self.linify *list Matrix.columns(list.first).to_a.map { |l| l.flatten } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems