huff 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/workspace.xml +56 -53
- data/lib/huff/encoder.rb +1 -1
- data/lib/huff/version.rb +1 -1
- data/spec/lib/huff/decoder_spec.rb +4 -2
- data/spec/lib/huff/encoder_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f35b96f6ac27f8770f4a6dd4ab7306207a4e1e88
|
4
|
+
data.tar.gz: bdba8b05c1dd9f97eacca5e395d62ab2588e7351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c7fcb62bd557c3393a9c5e3c0cb862c9893aac5bfee40f300ab930affb2dedfb76f1152fd78a2d5090bf6de816d9766a7bcc1ba7c6470b6da89d8964cfbc99
|
7
|
+
data.tar.gz: 5280644cfda6d487069bbb7397b878e1b984f3e54318d0e73e0e1cfe64ff3a871c533d46c2919cba066a2fed84076072a65c9e69c883e71cd854f1cb0484cdb2
|
data/.idea/workspace.xml
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
<project version="4">
|
3
3
|
<component name="ChangeListManager">
|
4
4
|
<list default="true" id="96567430-0205-40d6-9c2f-e203dffc5504" name="Default" comment="">
|
5
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb" afterPath="$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb" />
|
6
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/huff/encoder.rb" afterPath="$PROJECT_DIR$/lib/huff/encoder.rb" />
|
7
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb" afterPath="$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb" />
|
5
8
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/huff.gemspec" afterPath="$PROJECT_DIR$/huff.gemspec" />
|
6
9
|
</list>
|
7
10
|
<ignored path="huff.iws" />
|
@@ -24,31 +27,31 @@
|
|
24
27
|
</component>
|
25
28
|
<component name="FileEditorManager">
|
26
29
|
<leaf>
|
27
|
-
<file leaf-file-name="
|
28
|
-
<entry file="file://$PROJECT_DIR$/lib/huff/
|
30
|
+
<file leaf-file-name="encoder_spec.rb" pinned="false" current="false" current-in-tab="false">
|
31
|
+
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb">
|
29
32
|
<provider selected="true" editor-type-id="text-editor">
|
30
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="
|
31
|
-
<caret line="
|
33
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="468">
|
34
|
+
<caret line="3" column="11" selection-start-line="3" selection-start-column="11" selection-end-line="3" selection-end-column="11" />
|
32
35
|
<folding />
|
33
36
|
</state>
|
34
37
|
</provider>
|
35
38
|
</entry>
|
36
39
|
</file>
|
37
|
-
<file leaf-file-name="
|
38
|
-
<entry file="file://$PROJECT_DIR$/lib/huff/
|
40
|
+
<file leaf-file-name="encoder.rb" pinned="false" current="false" current-in-tab="false">
|
41
|
+
<entry file="file://$PROJECT_DIR$/lib/huff/encoder.rb">
|
39
42
|
<provider selected="true" editor-type-id="text-editor">
|
40
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="
|
41
|
-
<caret line="
|
43
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="396">
|
44
|
+
<caret line="13" column="42" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" />
|
42
45
|
<folding />
|
43
46
|
</state>
|
44
47
|
</provider>
|
45
48
|
</entry>
|
46
49
|
</file>
|
47
|
-
<file leaf-file-name="
|
48
|
-
<entry file="file://$PROJECT_DIR$/huff.
|
50
|
+
<file leaf-file-name="decoder_spec.rb" pinned="false" current="true" current-in-tab="true">
|
51
|
+
<entry file="file://$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb">
|
49
52
|
<provider selected="true" editor-type-id="text-editor">
|
50
|
-
<state vertical-scroll-proportion="0.
|
51
|
-
<caret line="
|
53
|
+
<state vertical-scroll-proportion="0.51724136" vertical-offset="0" max-vertical-offset="696">
|
54
|
+
<caret line="20" column="39" selection-start-line="20" selection-start-column="39" selection-end-line="20" selection-end-column="39" />
|
52
55
|
<folding />
|
53
56
|
</state>
|
54
57
|
</provider>
|
@@ -74,13 +77,13 @@
|
|
74
77
|
<option value="$PROJECT_DIR$/lib/huff/encoding_tree_builder.rb" />
|
75
78
|
<option value="$PROJECT_DIR$/lib/huff/encoding_table_builder.rb" />
|
76
79
|
<option value="$PROJECT_DIR$/spec/lib/huff/encoding_table_builder_spec.rb" />
|
77
|
-
<option value="$PROJECT_DIR$/lib/huff/encoder.rb" />
|
78
|
-
<option value="$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb" />
|
79
80
|
<option value="$PROJECT_DIR$/lib/huff/decoder.rb" />
|
80
|
-
<option value="$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb" />
|
81
81
|
<option value="$PROJECT_DIR$/lib/huff/frequency_meter.rb" />
|
82
82
|
<option value="$PROJECT_DIR$/lib/huff.rb" />
|
83
83
|
<option value="$PROJECT_DIR$/huff.gemspec" />
|
84
|
+
<option value="$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb" />
|
85
|
+
<option value="$PROJECT_DIR$/lib/huff/encoder.rb" />
|
86
|
+
<option value="$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb" />
|
84
87
|
</list>
|
85
88
|
</option>
|
86
89
|
</component>
|
@@ -368,30 +371,6 @@
|
|
368
371
|
</state>
|
369
372
|
</provider>
|
370
373
|
</entry>
|
371
|
-
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoding_tree_builder_spec.rb">
|
372
|
-
<provider selected="true" editor-type-id="text-editor">
|
373
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="666">
|
374
|
-
<caret line="29" column="58" selection-start-line="26" selection-start-column="42" selection-end-line="29" selection-end-column="58" />
|
375
|
-
<folding />
|
376
|
-
</state>
|
377
|
-
</provider>
|
378
|
-
</entry>
|
379
|
-
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb">
|
380
|
-
<provider selected="true" editor-type-id="text-editor">
|
381
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="468">
|
382
|
-
<caret line="18" column="66" selection-start-line="18" selection-start-column="57" selection-end-line="18" selection-end-column="66" />
|
383
|
-
<folding />
|
384
|
-
</state>
|
385
|
-
</provider>
|
386
|
-
</entry>
|
387
|
-
<entry file="file://$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb">
|
388
|
-
<provider selected="true" editor-type-id="text-editor">
|
389
|
-
<state vertical-scroll-proportion="0.07906296" vertical-offset="0" max-vertical-offset="683">
|
390
|
-
<caret line="3" column="17" selection-start-line="3" selection-start-column="17" selection-end-line="3" selection-end-column="17" />
|
391
|
-
<folding />
|
392
|
-
</state>
|
393
|
-
</provider>
|
394
|
-
</entry>
|
395
374
|
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoding_table_builder_spec.rb">
|
396
375
|
<provider selected="true" editor-type-id="text-editor">
|
397
376
|
<state vertical-scroll-proportion="0.23718888" vertical-offset="0" max-vertical-offset="683">
|
@@ -424,14 +403,6 @@
|
|
424
403
|
</state>
|
425
404
|
</provider>
|
426
405
|
</entry>
|
427
|
-
<entry file="file://$PROJECT_DIR$/lib/huff/encoder.rb">
|
428
|
-
<provider selected="true" editor-type-id="text-editor">
|
429
|
-
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="396">
|
430
|
-
<caret line="11" column="38" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
|
431
|
-
<folding />
|
432
|
-
</state>
|
433
|
-
</provider>
|
434
|
-
</entry>
|
435
406
|
<entry file="file://$PROJECT_DIR$/lib/huff/decoder.rb">
|
436
407
|
<provider selected="true" editor-type-id="text-editor">
|
437
408
|
<state vertical-scroll-proportion="0.38793105" vertical-offset="0" max-vertical-offset="738">
|
@@ -448,10 +419,10 @@
|
|
448
419
|
</state>
|
449
420
|
</provider>
|
450
421
|
</entry>
|
451
|
-
<entry file="file://$PROJECT_DIR$/
|
422
|
+
<entry file="file://$PROJECT_DIR$/huff.gemspec">
|
452
423
|
<provider selected="true" editor-type-id="text-editor">
|
453
|
-
<state vertical-scroll-proportion="0.
|
454
|
-
<caret line="
|
424
|
+
<state vertical-scroll-proportion="0.23718888" vertical-offset="0" max-vertical-offset="683">
|
425
|
+
<caret line="9" column="55" selection-start-line="9" selection-start-column="52" selection-end-line="9" selection-end-column="52" />
|
455
426
|
<folding />
|
456
427
|
</state>
|
457
428
|
</provider>
|
@@ -464,10 +435,42 @@
|
|
464
435
|
</state>
|
465
436
|
</provider>
|
466
437
|
</entry>
|
467
|
-
<entry file="file://$PROJECT_DIR$/huff.
|
438
|
+
<entry file="file://$PROJECT_DIR$/lib/huff/encoding_tree_builder.rb">
|
468
439
|
<provider selected="true" editor-type-id="text-editor">
|
469
|
-
<state vertical-scroll-proportion="0.
|
470
|
-
<caret line="
|
440
|
+
<state vertical-scroll-proportion="0.10344828" vertical-offset="0" max-vertical-offset="900">
|
441
|
+
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
442
|
+
<folding />
|
443
|
+
</state>
|
444
|
+
</provider>
|
445
|
+
</entry>
|
446
|
+
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoding_tree_builder_spec.rb">
|
447
|
+
<provider selected="true" editor-type-id="text-editor">
|
448
|
+
<state vertical-scroll-proportion="0.75" vertical-offset="0" max-vertical-offset="696">
|
449
|
+
<caret line="29" column="58" selection-start-line="26" selection-start-column="42" selection-end-line="29" selection-end-column="58" />
|
450
|
+
<folding />
|
451
|
+
</state>
|
452
|
+
</provider>
|
453
|
+
</entry>
|
454
|
+
<entry file="file://$PROJECT_DIR$/spec/lib/huff/encoder_spec.rb">
|
455
|
+
<provider selected="true" editor-type-id="text-editor">
|
456
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="468">
|
457
|
+
<caret line="3" column="11" selection-start-line="3" selection-start-column="11" selection-end-line="3" selection-end-column="11" />
|
458
|
+
<folding />
|
459
|
+
</state>
|
460
|
+
</provider>
|
461
|
+
</entry>
|
462
|
+
<entry file="file://$PROJECT_DIR$/lib/huff/encoder.rb">
|
463
|
+
<provider selected="true" editor-type-id="text-editor">
|
464
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="396">
|
465
|
+
<caret line="13" column="42" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" />
|
466
|
+
<folding />
|
467
|
+
</state>
|
468
|
+
</provider>
|
469
|
+
</entry>
|
470
|
+
<entry file="file://$PROJECT_DIR$/spec/lib/huff/decoder_spec.rb">
|
471
|
+
<provider selected="true" editor-type-id="text-editor">
|
472
|
+
<state vertical-scroll-proportion="0.51724136" vertical-offset="0" max-vertical-offset="696">
|
473
|
+
<caret line="20" column="39" selection-start-line="20" selection-start-column="39" selection-end-line="20" selection-end-column="39" />
|
471
474
|
<folding />
|
472
475
|
</state>
|
473
476
|
</provider>
|
data/lib/huff/encoder.rb
CHANGED
data/lib/huff/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe Decoder do
|
|
6
6
|
encoding_tree = ['c', ['b', 'a']]
|
7
7
|
subject = Decoder.new(encoding_tree)
|
8
8
|
expect(subject.decode_string('11100')).to eq 'abc'
|
9
|
-
expect(subject.decode_36('
|
9
|
+
expect(subject.decode_36('s')).to eq 'abc'
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'decodes a more complex string' do
|
@@ -16,6 +16,8 @@ describe Decoder do
|
|
16
16
|
['m', 'v']]]]
|
17
17
|
subject = Decoder.new(encoding_tree)
|
18
18
|
expect(subject.decode_string('1110000101000101001010011011000011111100100')).to eq 'mississipi river'
|
19
|
-
|
19
|
+
# Decoding is case insensitive
|
20
|
+
expect(subject.decode_36('2QrT5J4ro')).to eq 'mississipi river'
|
21
|
+
expect(subject.decode_36('2qRt5j4RO')).to eq 'mississipi river'
|
20
22
|
end
|
21
23
|
end
|
@@ -6,7 +6,7 @@ describe Encoder do
|
|
6
6
|
encoding_tree = ['c', ['b', 'a']]
|
7
7
|
subject = Encoder.new(encoding_tree)
|
8
8
|
expect(subject.encode_string('abc')).to eq '11100'
|
9
|
-
expect(subject.encode_36('abc')).to eq '
|
9
|
+
expect(subject.encode_36('abc')).to eq 's'
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'encode a more complex string' do
|
@@ -16,6 +16,6 @@ describe Encoder do
|
|
16
16
|
['m', 'v']]]]
|
17
17
|
subject = Encoder.new(encoding_tree)
|
18
18
|
expect(subject.encode_string('mississipi river')).to eq '1110000101000101001010011011000011111100100'
|
19
|
-
expect(subject.encode_36('mississipi river')).to eq '
|
19
|
+
expect(subject.encode_36('mississipi river')).to eq '2qrt5j4ro'
|
20
20
|
end
|
21
21
|
end
|