nineteen-eighty-two 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f46e15b6304a47beff3b22b3eecfc36a19314d87
4
+ data.tar.gz: 8edb0ae9ea7535e45f03cc2bd0a4bba9d5afc229
5
+ SHA512:
6
+ metadata.gz: 2e29b9d32afebf91e731a3d4ff36ec5ef713e8296e9730816d4e0c3dc13b5a65c2c122ba604aab0ad5f105a48e754f640842a7aa5b6161237470ec0ceee601cc
7
+ data.tar.gz: ab91284f03235968ea6b6d191064be0be223339d46298361a90f10827cd8400cd83b6e202ee3631bfdd9dc4fd8ddf37bb0a1458adc7ad0176bd63bc46d1df5d3
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at github@orgraphone.org. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nineteen-eighty-two.gemspec
4
+ gemspec
5
+
6
+ gem 'pry'
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ ##Copyright (c) 2015 Sam Pikesley
2
+
3
+ #MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,6 @@
1
+ [![Build Status](http://img.shields.io/travis/pikesley/nineteen-eighty-two.svg?style=flat-square)](https://travis-ci.org/pikesley/nineteen-eighty-two)
2
+ [![Dependency Status](http://img.shields.io/gemnasium/pikesley/nineteen-eighty-two.svg?style=flat-square)](https://gemnasium.com/pikesley/nineteen-eighty-two)
3
+ [![Coverage Status](http://img.shields.io/coveralls/pikesley/nineteen-eighty-two.svg?style=flat-square)](https://coveralls.io/r/pikesley/nineteen-eighty-two)
4
+ [![Code Climate](http://img.shields.io/codeclimate/github/pikesley/nineteen-eighty-two.svg?style=flat-square)](https://codeclimate.com/github/pikesley/nineteen-eighty-two)
5
+ [![Gem Version](http://img.shields.io/gem/v/nineteen-eighty-two.svg?style=flat-square)](https://rubygems.org/gems/nineteen-eighty-two)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://pikesley.mit-license.org)
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'coveralls/rake/task'
4
+
5
+ Coveralls::RakeTask.new
6
+ RSpec::Core::RakeTask.new
7
+
8
+ task :default => [:spec, 'coveralls:push']
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nineteen/eighty/two"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,864 @@
1
+ " ":
2
+ - 0
3
+ - 0
4
+ - 0
5
+ - 0
6
+ - 0
7
+ - 0
8
+ - 0
9
+ - 0
10
+ "!":
11
+ - 0
12
+ - 16
13
+ - 16
14
+ - 16
15
+ - 16
16
+ - 0
17
+ - 16
18
+ - 0
19
+ "\"":
20
+ - 0
21
+ - 36
22
+ - 36
23
+ - 0
24
+ - 0
25
+ - 0
26
+ - 0
27
+ - 0
28
+ "#":
29
+ - 0
30
+ - 36
31
+ - 126
32
+ - 36
33
+ - 36
34
+ - 126
35
+ - 36
36
+ - 0
37
+ "$":
38
+ - 0
39
+ - 8
40
+ - 62
41
+ - 40
42
+ - 62
43
+ - 10
44
+ - 62
45
+ - 8
46
+ "%":
47
+ - 0
48
+ - 98
49
+ - 100
50
+ - 8
51
+ - 16
52
+ - 38
53
+ - 70
54
+ - 0
55
+ "&":
56
+ - 0
57
+ - 16
58
+ - 40
59
+ - 16
60
+ - 42
61
+ - 68
62
+ - 58
63
+ - 0
64
+ "'":
65
+ - 0
66
+ - 8
67
+ - 16
68
+ - 0
69
+ - 0
70
+ - 0
71
+ - 0
72
+ - 0
73
+ "(":
74
+ - 0
75
+ - 4
76
+ - 8
77
+ - 8
78
+ - 8
79
+ - 8
80
+ - 4
81
+ - 0
82
+ ")":
83
+ - 0
84
+ - 32
85
+ - 16
86
+ - 16
87
+ - 16
88
+ - 16
89
+ - 32
90
+ - 0
91
+ "*":
92
+ - 0
93
+ - 0
94
+ - 20
95
+ - 8
96
+ - 62
97
+ - 8
98
+ - 20
99
+ - 0
100
+ "+":
101
+ - 0
102
+ - 0
103
+ - 8
104
+ - 8
105
+ - 62
106
+ - 8
107
+ - 8
108
+ - 0
109
+ ",":
110
+ - 0
111
+ - 0
112
+ - 0
113
+ - 0
114
+ - 0
115
+ - 8
116
+ - 8
117
+ - 16
118
+ "-":
119
+ - 0
120
+ - 0
121
+ - 0
122
+ - 0
123
+ - 62
124
+ - 0
125
+ - 0
126
+ - 0
127
+ ".":
128
+ - 0
129
+ - 0
130
+ - 0
131
+ - 0
132
+ - 0
133
+ - 24
134
+ - 24
135
+ - 0
136
+ "/":
137
+ - 0
138
+ - 0
139
+ - 2
140
+ - 4
141
+ - 8
142
+ - 16
143
+ - 32
144
+ - 0
145
+ '0':
146
+ - 0
147
+ - 60
148
+ - 70
149
+ - 74
150
+ - 82
151
+ - 98
152
+ - 60
153
+ - 0
154
+ '1':
155
+ - 0
156
+ - 24
157
+ - 40
158
+ - 8
159
+ - 8
160
+ - 8
161
+ - 62
162
+ - 0
163
+ '2':
164
+ - 0
165
+ - 60
166
+ - 66
167
+ - 2
168
+ - 60
169
+ - 64
170
+ - 126
171
+ - 0
172
+ '3':
173
+ - 0
174
+ - 60
175
+ - 66
176
+ - 12
177
+ - 2
178
+ - 66
179
+ - 60
180
+ - 0
181
+ '4':
182
+ - 0
183
+ - 8
184
+ - 24
185
+ - 40
186
+ - 72
187
+ - 126
188
+ - 8
189
+ - 0
190
+ '5':
191
+ - 0
192
+ - 126
193
+ - 64
194
+ - 124
195
+ - 2
196
+ - 66
197
+ - 60
198
+ - 0
199
+ '6':
200
+ - 0
201
+ - 60
202
+ - 64
203
+ - 124
204
+ - 66
205
+ - 66
206
+ - 60
207
+ - 0
208
+ '7':
209
+ - 0
210
+ - 126
211
+ - 2
212
+ - 4
213
+ - 8
214
+ - 16
215
+ - 16
216
+ - 0
217
+ '8':
218
+ - 0
219
+ - 60
220
+ - 66
221
+ - 60
222
+ - 66
223
+ - 66
224
+ - 60
225
+ - 0
226
+ '9':
227
+ - 0
228
+ - 60
229
+ - 66
230
+ - 66
231
+ - 62
232
+ - 2
233
+ - 60
234
+ - 0
235
+ ":":
236
+ - 0
237
+ - 0
238
+ - 0
239
+ - 16
240
+ - 0
241
+ - 0
242
+ - 16
243
+ - 0
244
+ ";":
245
+ - 0
246
+ - 0
247
+ - 16
248
+ - 0
249
+ - 0
250
+ - 16
251
+ - 16
252
+ - 32
253
+ "<":
254
+ - 0
255
+ - 0
256
+ - 4
257
+ - 8
258
+ - 16
259
+ - 8
260
+ - 4
261
+ - 0
262
+ "=":
263
+ - 0
264
+ - 0
265
+ - 0
266
+ - 62
267
+ - 0
268
+ - 62
269
+ - 0
270
+ - 0
271
+ ">":
272
+ - 0
273
+ - 0
274
+ - 16
275
+ - 8
276
+ - 4
277
+ - 8
278
+ - 16
279
+ - 0
280
+ "?":
281
+ - 0
282
+ - 60
283
+ - 66
284
+ - 4
285
+ - 8
286
+ - 0
287
+ - 8
288
+ - 0
289
+ "@":
290
+ - 0
291
+ - 60
292
+ - 74
293
+ - 86
294
+ - 94
295
+ - 64
296
+ - 60
297
+ - 0
298
+ A:
299
+ - 0
300
+ - 60
301
+ - 66
302
+ - 66
303
+ - 126
304
+ - 66
305
+ - 66
306
+ - 0
307
+ B:
308
+ - 0
309
+ - 124
310
+ - 66
311
+ - 124
312
+ - 66
313
+ - 66
314
+ - 124
315
+ - 0
316
+ C:
317
+ - 0
318
+ - 60
319
+ - 66
320
+ - 64
321
+ - 64
322
+ - 66
323
+ - 60
324
+ - 0
325
+ D:
326
+ - 0
327
+ - 120
328
+ - 68
329
+ - 66
330
+ - 66
331
+ - 68
332
+ - 120
333
+ - 0
334
+ E:
335
+ - 0
336
+ - 126
337
+ - 64
338
+ - 124
339
+ - 64
340
+ - 64
341
+ - 126
342
+ - 0
343
+ F:
344
+ - 0
345
+ - 126
346
+ - 64
347
+ - 124
348
+ - 64
349
+ - 64
350
+ - 64
351
+ - 0
352
+ G:
353
+ - 0
354
+ - 60
355
+ - 66
356
+ - 64
357
+ - 78
358
+ - 66
359
+ - 60
360
+ - 0
361
+ H:
362
+ - 0
363
+ - 66
364
+ - 66
365
+ - 126
366
+ - 66
367
+ - 66
368
+ - 66
369
+ - 0
370
+ I:
371
+ - 0
372
+ - 62
373
+ - 8
374
+ - 8
375
+ - 8
376
+ - 8
377
+ - 62
378
+ - 0
379
+ J:
380
+ - 0
381
+ - 2
382
+ - 2
383
+ - 2
384
+ - 66
385
+ - 66
386
+ - 60
387
+ - 0
388
+ K:
389
+ - 0
390
+ - 68
391
+ - 72
392
+ - 112
393
+ - 72
394
+ - 68
395
+ - 66
396
+ - 0
397
+ L:
398
+ - 0
399
+ - 64
400
+ - 64
401
+ - 64
402
+ - 64
403
+ - 64
404
+ - 126
405
+ - 0
406
+ M:
407
+ - 0
408
+ - 66
409
+ - 102
410
+ - 90
411
+ - 66
412
+ - 66
413
+ - 66
414
+ - 0
415
+ N:
416
+ - 0
417
+ - 66
418
+ - 98
419
+ - 82
420
+ - 74
421
+ - 70
422
+ - 66
423
+ - 0
424
+ O:
425
+ - 0
426
+ - 60
427
+ - 66
428
+ - 66
429
+ - 66
430
+ - 66
431
+ - 60
432
+ - 0
433
+ P:
434
+ - 0
435
+ - 124
436
+ - 66
437
+ - 66
438
+ - 124
439
+ - 64
440
+ - 64
441
+ - 0
442
+ Q:
443
+ - 0
444
+ - 60
445
+ - 66
446
+ - 66
447
+ - 82
448
+ - 74
449
+ - 60
450
+ - 0
451
+ R:
452
+ - 0
453
+ - 124
454
+ - 66
455
+ - 66
456
+ - 124
457
+ - 68
458
+ - 66
459
+ - 0
460
+ S:
461
+ - 0
462
+ - 60
463
+ - 64
464
+ - 60
465
+ - 2
466
+ - 66
467
+ - 60
468
+ - 0
469
+ T:
470
+ - 0
471
+ - 254
472
+ - 16
473
+ - 16
474
+ - 16
475
+ - 16
476
+ - 16
477
+ - 0
478
+ U:
479
+ - 0
480
+ - 66
481
+ - 66
482
+ - 66
483
+ - 66
484
+ - 66
485
+ - 60
486
+ - 0
487
+ V:
488
+ - 0
489
+ - 66
490
+ - 66
491
+ - 66
492
+ - 66
493
+ - 36
494
+ - 24
495
+ - 0
496
+ W:
497
+ - 0
498
+ - 66
499
+ - 66
500
+ - 66
501
+ - 66
502
+ - 90
503
+ - 36
504
+ - 0
505
+ X:
506
+ - 0
507
+ - 66
508
+ - 36
509
+ - 24
510
+ - 24
511
+ - 36
512
+ - 66
513
+ - 0
514
+ Y:
515
+ - 0
516
+ - 130
517
+ - 68
518
+ - 40
519
+ - 16
520
+ - 16
521
+ - 16
522
+ - 0
523
+ Z:
524
+ - 0
525
+ - 126
526
+ - 4
527
+ - 8
528
+ - 16
529
+ - 32
530
+ - 126
531
+ - 0
532
+ "[":
533
+ - 0
534
+ - 14
535
+ - 8
536
+ - 8
537
+ - 8
538
+ - 8
539
+ - 14
540
+ - 0
541
+ "\\":
542
+ - 0
543
+ - 0
544
+ - 64
545
+ - 32
546
+ - 16
547
+ - 8
548
+ - 4
549
+ - 0
550
+ "]":
551
+ - 0
552
+ - 112
553
+ - 16
554
+ - 16
555
+ - 16
556
+ - 16
557
+ - 112
558
+ - 0
559
+ "^":
560
+ - 0
561
+ - 16
562
+ - 56
563
+ - 84
564
+ - 16
565
+ - 16
566
+ - 16
567
+ - 0
568
+ _:
569
+ - 0
570
+ - 0
571
+ - 0
572
+ - 0
573
+ - 0
574
+ - 0
575
+ - 0
576
+ - 255
577
+ "£":
578
+ - 0
579
+ - 28
580
+ - 34
581
+ - 120
582
+ - 32
583
+ - 32
584
+ - 126
585
+ - 0
586
+ a:
587
+ - 0
588
+ - 0
589
+ - 56
590
+ - 4
591
+ - 60
592
+ - 68
593
+ - 60
594
+ - 0
595
+ b:
596
+ - 0
597
+ - 32
598
+ - 32
599
+ - 60
600
+ - 34
601
+ - 34
602
+ - 60
603
+ - 0
604
+ c:
605
+ - 0
606
+ - 0
607
+ - 28
608
+ - 32
609
+ - 32
610
+ - 32
611
+ - 28
612
+ - 0
613
+ d:
614
+ - 0
615
+ - 4
616
+ - 4
617
+ - 60
618
+ - 68
619
+ - 68
620
+ - 60
621
+ - 0
622
+ e:
623
+ - 0
624
+ - 0
625
+ - 56
626
+ - 68
627
+ - 120
628
+ - 64
629
+ - 60
630
+ - 0
631
+ f:
632
+ - 0
633
+ - 12
634
+ - 16
635
+ - 24
636
+ - 16
637
+ - 16
638
+ - 16
639
+ - 0
640
+ g:
641
+ - 0
642
+ - 0
643
+ - 60
644
+ - 68
645
+ - 68
646
+ - 60
647
+ - 4
648
+ - 56
649
+ h:
650
+ - 0
651
+ - 64
652
+ - 64
653
+ - 120
654
+ - 68
655
+ - 68
656
+ - 68
657
+ - 0
658
+ i:
659
+ - 0
660
+ - 16
661
+ - 0
662
+ - 48
663
+ - 16
664
+ - 16
665
+ - 56
666
+ - 0
667
+ j:
668
+ - 0
669
+ - 4
670
+ - 0
671
+ - 4
672
+ - 4
673
+ - 4
674
+ - 36
675
+ - 24
676
+ k:
677
+ - 0
678
+ - 32
679
+ - 40
680
+ - 48
681
+ - 48
682
+ - 40
683
+ - 36
684
+ - 0
685
+ l:
686
+ - 0
687
+ - 16
688
+ - 16
689
+ - 16
690
+ - 16
691
+ - 16
692
+ - 12
693
+ - 0
694
+ m:
695
+ - 0
696
+ - 0
697
+ - 104
698
+ - 84
699
+ - 84
700
+ - 84
701
+ - 84
702
+ - 0
703
+ n:
704
+ - 0
705
+ - 0
706
+ - 120
707
+ - 68
708
+ - 68
709
+ - 68
710
+ - 68
711
+ - 0
712
+ o:
713
+ - 0
714
+ - 0
715
+ - 56
716
+ - 68
717
+ - 68
718
+ - 68
719
+ - 56
720
+ - 0
721
+ p:
722
+ - 0
723
+ - 0
724
+ - 120
725
+ - 68
726
+ - 68
727
+ - 120
728
+ - 64
729
+ - 64
730
+ q:
731
+ - 0
732
+ - 0
733
+ - 60
734
+ - 68
735
+ - 68
736
+ - 60
737
+ - 4
738
+ - 6
739
+ r:
740
+ - 0
741
+ - 0
742
+ - 28
743
+ - 32
744
+ - 32
745
+ - 32
746
+ - 32
747
+ - 0
748
+ s:
749
+ - 0
750
+ - 0
751
+ - 56
752
+ - 64
753
+ - 56
754
+ - 4
755
+ - 120
756
+ - 0
757
+ t:
758
+ - 0
759
+ - 16
760
+ - 56
761
+ - 16
762
+ - 16
763
+ - 16
764
+ - 12
765
+ - 0
766
+ u:
767
+ - 0
768
+ - 0
769
+ - 68
770
+ - 68
771
+ - 68
772
+ - 68
773
+ - 56
774
+ - 0
775
+ v:
776
+ - 0
777
+ - 0
778
+ - 68
779
+ - 68
780
+ - 40
781
+ - 40
782
+ - 16
783
+ - 0
784
+ w:
785
+ - 0
786
+ - 0
787
+ - 68
788
+ - 84
789
+ - 84
790
+ - 84
791
+ - 40
792
+ - 0
793
+ x:
794
+ - 0
795
+ - 0
796
+ - 68
797
+ - 40
798
+ - 16
799
+ - 40
800
+ - 68
801
+ - 0
802
+ y:
803
+ - 0
804
+ - 0
805
+ - 68
806
+ - 68
807
+ - 68
808
+ - 60
809
+ - 4
810
+ - 56
811
+ z:
812
+ - 0
813
+ - 0
814
+ - 124
815
+ - 8
816
+ - 16
817
+ - 32
818
+ - 124
819
+ - 0
820
+ "{":
821
+ - 0
822
+ - 14
823
+ - 8
824
+ - 48
825
+ - 8
826
+ - 8
827
+ - 14
828
+ - 0
829
+ "|":
830
+ - 0
831
+ - 8
832
+ - 8
833
+ - 8
834
+ - 8
835
+ - 8
836
+ - 8
837
+ - 0
838
+ "}":
839
+ - 0
840
+ - 112
841
+ - 16
842
+ - 12
843
+ - 16
844
+ - 16
845
+ - 112
846
+ - 0
847
+ "~":
848
+ - 0
849
+ - 20
850
+ - 40
851
+ - 0
852
+ - 0
853
+ - 0
854
+ - 0
855
+ - 0
856
+ "©":
857
+ - 60
858
+ - 66
859
+ - 153
860
+ - 161
861
+ - 161
862
+ - 153
863
+ - 66
864
+ - 60
@@ -0,0 +1,11 @@
1
+ require 'yaml'
2
+ require 'matrix'
3
+
4
+ require 'nineteen/eighty/two/version'
5
+ require 'nineteen/eighty/two/spectrum'
6
+
7
+ require 'nineteen/eighty/two/decorators/run_length_encoder'
8
+
9
+ require 'nineteen/eighty/two/formatters/text_formatter'
10
+ require 'nineteen/eighty/two/formatters/json_formatter'
11
+ require 'nineteen/eighty/two/formatters/html_table_formatter'
@@ -0,0 +1,31 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ module Decorators
5
+ class RunLengthEncoder
6
+ def self.encode row
7
+ result = []
8
+ count = 0
9
+ step = 0
10
+ while step < row.length
11
+ current = row[step]
12
+ step += 1
13
+ nxt = row[step]
14
+ if nxt == current
15
+ count += 1
16
+ else
17
+ result << {
18
+ current => count + 1
19
+ }
20
+ count = 0
21
+ current = nxt
22
+ end
23
+ end
24
+
25
+ result
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,58 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ module Formatters
5
+ class HTMLTableFormatter
6
+ def self.format text
7
+ s = '<!-- %s -->' % text
8
+ s << '<table class="sinclair">'
9
+
10
+ lines = Spectrum[text]
11
+ s << self.build_row(self.make_blanks(lines.first))
12
+
13
+ lines.each { |line| s << self.build_row(Nineteen::Eighty::Two::Decorators::RunLengthEncoder.encode line) }
14
+
15
+ s << '</table>'
16
+ s
17
+ end
18
+
19
+ def self.make_blanks text
20
+ a = []
21
+ (text.length * 8).times do |bit|
22
+ a << { 0 => 1 }
23
+ end
24
+
25
+ a
26
+ end
27
+
28
+ def self.convert_line line
29
+ line.map! { |i|
30
+ {
31
+ :class => i.keys[0] == 1 ? "on" : "off",
32
+ :colspan => i.values[0]
33
+ }
34
+ }
35
+ end
36
+
37
+ def self.build_row line
38
+ s = '<tr class="sinclair">'
39
+
40
+ convert_line line
41
+
42
+ line.each do |bit|
43
+ s << '<td class="%s"' % bit[:class]
44
+ if bit[:colspan] > 1
45
+ s << ' colspan="%d"' % bit[:colspan]
46
+ end
47
+ s << '> </td>'
48
+ end
49
+
50
+ s << '</tr>'
51
+
52
+ s
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,16 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ module Formatters
5
+ class JSONFormatter
6
+ def self.format text
7
+ {
8
+ id: text,
9
+ data: Spectrum[text]
10
+ }.to_json
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ module Formatters
5
+ class TextFormatter
6
+ def self.format text, options = {}
7
+ on = options.fetch(:on, '1')
8
+ off = options.fetch(:off, '0')
9
+
10
+ Spectrum[text].map { |t| t.join }.join("\n").gsub('0', off).gsub('1', on)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ class Spectrum
5
+ CHARACTERS = YAML.load_file File.join File.dirname(__FILE__), '..', '..', '..', '..', 'config', 'characters.yml'
6
+
7
+ def self.[] text
8
+ Spectrum.linify text.chars.map { |c| Spectrum.get(c) }
9
+ end
10
+
11
+ def self.get key
12
+ key = ' ' unless CHARACTERS[key]
13
+ CHARACTERS[key].map { |b| Spectrum.bits(b) }
14
+ end
15
+
16
+ def self.bits number
17
+ (0..7).map do |i|
18
+ number[i]
19
+ end.reverse
20
+ end
21
+
22
+ def self.linify *list
23
+ Matrix.columns(list.first).to_a.map { |l| l.flatten }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ module Nineteen
2
+ module Eighty
3
+ module Two
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nineteen/eighty/two/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'nineteen-eighty-two'
8
+ spec.version = Nineteen::Eighty::Two::VERSION
9
+ spec.authors = ['pikesley']
10
+ spec.email = ['github@orgraphone.org']
11
+
12
+ spec.summary = %q{© 1982 Sinclair Research Ltd.}
13
+ spec.description = %q{© 1982 Sinclair Research Ltd.}
14
+ spec.homepage = 'http://pikesley.org'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.12'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec', '~> 3.0'
25
+ spec.add_development_dependency 'coveralls', '~> 0.8'
26
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nineteen-eighty-two
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - pikesley
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
69
+ description: "© 1982 Sinclair Research Ltd."
70
+ email:
71
+ - github@orgraphone.org
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - CODE_OF_CONDUCT.md
80
+ - Gemfile
81
+ - LICENSE.md
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - config/characters.yml
87
+ - lib/nineteen/eighty/two.rb
88
+ - lib/nineteen/eighty/two/decorators/run_length_encoder.rb
89
+ - lib/nineteen/eighty/two/formatters/html_table_formatter.rb
90
+ - lib/nineteen/eighty/two/formatters/json_formatter.rb
91
+ - lib/nineteen/eighty/two/formatters/text_formatter.rb
92
+ - lib/nineteen/eighty/two/spectrum.rb
93
+ - lib/nineteen/eighty/two/version.rb
94
+ - nineteen-eighty-two.gemspec
95
+ homepage: http://pikesley.org
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.5.1
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: "© 1982 Sinclair Research Ltd."
119
+ test_files: []