README.md in nineteen-eighty-two-0.1.6 vs README.md in nineteen-eighty-two-0.1.7

- old
+ new

@@ -5,30 +5,39 @@ [![Gem Version](http://img.shields.io/gem/v/nineteen-eighty-two.svg?style=flat-square)](https://rubygems.org/gems/nineteen-eighty-two) [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://pikesley.mit-license.org) # 1982 -## Sinclair Spectrum font as a Rubygem +## Sinclair Spectrum Stuff as a Rubygem -A massively over-engineered solution to a problem that I'm almost 100% certain does not exist - rendering text in the 1982 Sinclair Spectrum character set, in a variety of formats +A massively over-engineered solution to a set of problems that I'm almost 100% certain do not exist +* rendering text in the 1982 Sinclair Spectrum character set, in a variety of formats +* serving all of the Spectrum's 15 colours as HTML hex colours +* serving the complete set of Spectrum error messages + +## Install + git clone https://github.com/pikesley/nineteen-eighty-two cd nineteen-eighty-two bundle rake + rake install Or just gem install nineteen-eighty-two ## API +### Font + From the [specs](https://github.com/pikesley/nineteen-eighty-two/tree/master/spec/nineteen/eighty/two): -### Just the data +#### Just the data -#### Transform a string into an array-of-arrays of bits +##### Transform a string into an array-of-arrays of bits require 'nineteen/eighty/two' module Nineteen::Eighty::Two describe Spectrum do @@ -45,13 +54,13 @@ ] end end end -### Specific output formats +#### Specific output formats -#### HTML table +##### HTML table require 'nineteen/eighty/two' module Nineteen::Eighty::Two module Formats @@ -73,11 +82,11 @@ ) end end end -#### JSON +##### JSON require 'nineteen/eighty/two' module Nineteen::Eighty::Two module Formats @@ -97,11 +106,11 @@ }.to_json) end end end -#### SVG +##### SVG require 'nineteen/eighty/two' module Nineteen::Eighty::Two module Formats @@ -132,11 +141,11 @@ end end end end -#### Text +##### Text require 'nineteen/eighty/two' module Nineteen::Eighty::Two module Formats @@ -167,9 +176,60 @@ .X....X..X...X...X.X.X.. ..XXXX....XXXX...X.X.X.. ........................ """ ).strip + end + end + end + +### Colours + + require 'nineteen/eighty/two' + + module Nineteen::Eighty::Two + describe Colours do + it 'knows what red is' do + expect(described_class['red']).to eq 'bf0000' + end + + it 'knows how to make magenta' do + expect(described_class['magenta']).to eq 'bf00bf' + end + + context 'BRIGHT colours' do + specify 'primary colours' do + expect(described_class['GREEN']).to eq '00ff00' + end + end + + context 'method-type access' do + it 'allows method-type access' do + expect(described_class.blue).to eq '0000bf' + end + end + end + end + +### Error messages + + require 'nineteen/eighty/two' + + module Nineteen::Eighty::Two + describe Messages do + it 'has error messages' do + expect(described_class['R']).to eq 'R - Tape loading error' + end + + it 'supports case-insensitive lookups' do + expect(described_class['c']).to eq 'C - Nonsense in BASIC' + end + + it 'is polite about non-existent keys' do + expect { described_class['Z'] }.to raise_exception do |e| + expect(e).to be_an Exceptions::SpectrumException + expect(e.message).to eq 'Q - Parameter error' + end end end end ## FAQ