huffnpuff 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d53cb2641733aa17816bf18f3482c9917111bcc
4
- data.tar.gz: e4af27561bb0efdd23c19a95ba8e20771c79f007
3
+ metadata.gz: 0f6f9982326257ddd17e5f58ed06d36ff816b60f
4
+ data.tar.gz: 8661eb89086f40a10c3b02260de86c45278639b0
5
5
  SHA512:
6
- metadata.gz: 43e413245fcea87c5b5cd2078b6a69ce29470beaeba838e907da7658c0c7742878e0194753f48d17b57a04e6ba598f692b349d915934910f313ddfd832e583d2
7
- data.tar.gz: 0da34b39907367109459aa7c2e8b6579a20d6bd806e42cc038b00dfa69f58916d4991ea9ba8545084584a08d9241033eca26a8d66a0122a1def0a6ad8eb28f5a
6
+ metadata.gz: 77a99b1d9791f338538a58e2f90774e54ac40cf925008cadb48a99b9e066ec6b423de0e5d765695d3cd837bacfe63be028b9f071d51141dfb3926ebdef6bd0ce
7
+ data.tar.gz: e7dd40d9e24ddfd2c882059299211020bd8362a7768d3bf047ef3424f0bb3fba70c73f603f34443fca2444d19e13bdfae87617a0c4516917a9d79be2e8cd78d7
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  `Huffnpuff` implements a general purpose Huffman Coding system that uses a construction string which can implement any system.
4
4
  This also includes the `bitfifo` gem which allows variable length bit sequences to address the internal table of the
5
- `Huffnpuff` object instance.
5
+ `Huffnpuff` object instance. Huffman coding is essential for compression techniques such as MPEG, and PKZIP.
6
6
 
7
7
  ## Installation
8
8
 
@@ -142,8 +142,17 @@ Huffnpuff has the following methods:
142
142
  # huff.get ... returns data indexed by external bitfifo
143
143
  ```
144
144
 
145
+ ## Revision History
146
+
147
+ ### Version 0.1.1
148
+
149
+ * fixed some error messages
150
+ * fixed systemize!
151
+ * more test cases
152
+
145
153
  ## Development
146
154
 
155
+
147
156
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
148
157
 
149
158
  To install this gem onto your local machine, run `bundle exec rake install`.
@@ -17,18 +17,18 @@ class Huffnpuff
17
17
  raise "singular bin not valid" if 1==ary.count
18
18
  ary.each do |bin|
19
19
  raise "empty bin definition" if bin.empty?
20
- raise "preamble missing: must start with 1 or 0" if bin[0]=='x'
20
+ raise "preamble missing: must start with 1 or 0" unless (bin[0]=='0' || bin[0]=='1')
21
21
  xmode = false
22
22
  bin.each_char do |ch|
23
23
  if xmode
24
- raise "illegal char following 'x': ['#{ch}']" unless 'x'==ch
24
+ raise "illegal char following 'x': [#{ch}]" unless 'x'==ch
25
25
  else
26
26
  if ch=='x'
27
27
  xmode = true
28
28
  elsif ch=='0'
29
29
  elsif ch=='1'
30
30
  else
31
- raise "invalid symbol #{ch}"
31
+ raise "invalid symbol [#{ch}]"
32
32
  end
33
33
  end
34
34
  end
@@ -40,7 +40,7 @@ class Huffnpuff
40
40
 
41
41
  def self.get_system_string_from_histogram(ary, rat = 0.61)
42
42
  raise "histogram array must be reverse sorted with values >= 1" unless histogram_array_valid?(ary)
43
- raise "parameter 2 must be between 0.2 and 0.8" unless ((rat >= 0.1) && (rat <= 0.9))
43
+ raise "parameter 2 must be between 0.1 and 0.9" unless ((rat >= 0.1) && (rat <= 0.9))
44
44
  sys = []
45
45
  top = (rat * 4096.0).to_i
46
46
  n = ary.count - 1
@@ -84,7 +84,6 @@ class Huffnpuff
84
84
  def initialize(sys, fifo, dat = [])
85
85
  @data = dat
86
86
  @fifo = fifo
87
- @ary = []
88
87
  systemize!(sys)
89
88
  end
90
89
  def min
@@ -102,6 +101,7 @@ class Huffnpuff
102
101
  end
103
102
 
104
103
  def systemize!(sys)
104
+ @ary = []
105
105
  if sys.kind_of? String
106
106
  @sys = sys
107
107
  ary = sys.split(':')
@@ -1,3 +1,3 @@
1
1
  class Huffnpuff
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huffnpuff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Colvin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitfifo