imageparser 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/imageparser.rb +10 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9224f6612674b78351e29003b198a436002062b8
4
- data.tar.gz: fe75e04b192be63ca2f4f7b495c67246ec3a7982
3
+ metadata.gz: 9a1b5a6df5b0fc38d8d29d0a6e6158d27dc06b4f
4
+ data.tar.gz: 5e234d10606d74c6670d2be699c2b838f2aab8aa
5
5
  SHA512:
6
- metadata.gz: b394dff8f98f303a58c4538f47c4d54a6ee6458f7037b108fde6700a53bad00855601552eef3cf6cda8cea62147241c5c5dc484728a97ad75058dc7f9e7a31d1
7
- data.tar.gz: f7366c3d64043b3633f141d1db82f08f9a1aea9a681b527649f04bab87e29802d7f17a877efdcf3e7793be71e4fbcc6579ec38f2c18392251fd97d451a125687
6
+ metadata.gz: b2fe83421c08af9db6bdf6b7b7699b0ee5e5aafe9fe45936b542a433527d41f47677c30c77fbf21a1441b4ebcb1299292eeffd34a0a5553443c970c1328d886d
7
+ data.tar.gz: 2d4bae27e06e34e6751305c9652749aadd70902e6cbab64aee892e838c1b4d49356df7bd25d18b1a1ca427e7051e58935790670d2b01e002156ae11bfa0dcbc0
data/lib/imageparser.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Supports PPM and PTF file formats.
4
4
  class ImageParser
5
- # File descriptor reading accessor
5
+ # File descriptor reading accessor.
6
6
  attr_accessor :con
7
7
 
8
8
  # Initialize the file
@@ -18,19 +18,20 @@ class ImageParser
18
18
  # Add parsed results into the hash `info`.
19
19
  #
20
20
  # These results are, the header, the width, the height, the RGB max value, the raster and the raster grid.
21
+ #
21
22
  # Example: parse_ppm(hash)
22
23
  #
23
- # hash[:header] = "P6"
24
+ # hash, :header = "P6"
24
25
  #
25
- # hash[:width] = 4
26
+ # hash, :width = 4
26
27
  #
27
- # hash[:height] = 4
28
+ # hash, :height = 4
28
29
  #
29
- # hash[:rgb] = 255
30
+ # hash, :rgb = 255
30
31
  #
31
- # hash[:raster] = [255, 42, 55, ..]
32
+ # hash, :raster = [255, 42, 55, ..]
32
33
  #
33
- # hash[:raster_grid] = [[34, 43, 55], ..]
34
+ # hash, :raster_grid = [[34, 43, 55], ..]
34
35
  def parse_ppm(info)
35
36
  info[:header] = @con.split(" ")[0] if @con.split(" ")[0] == "P6"
36
37
  info[:width] = @con.split(" ")[1].to_i if @con.split(" ")[1].to_i > 0
@@ -48,9 +49,9 @@ class ImageParser
48
49
  #
49
50
  # Example: parse_ptf(hash)
50
51
  #
51
- # hash[:header] = "PTF1"
52
+ # hash, :header = "PTF1"
52
53
  #
53
- # hash[:color_info] = [3, 2, 33, 3]
54
+ # hash, :color_info = [3, 2, 33, 3]
54
55
  def parse_ptf(info)
55
56
  info[:header] = @con.split(" ")[0] if @con.split(" ")[0] == "PTF1"
56
57
  info[:color_info] = @con.split(",")[1..-1].map {|s| s.delete ' '}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imageparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Himpon