imageparser 0.0.2 → 0.0.3

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 +19 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b253dac11ff248c2027a133b165cf0ea8d81c8cd
4
- data.tar.gz: d7e1294443bc68d552a039da11210d75afd1ac79
3
+ metadata.gz: 9224f6612674b78351e29003b198a436002062b8
4
+ data.tar.gz: fe75e04b192be63ca2f4f7b495c67246ec3a7982
5
5
  SHA512:
6
- metadata.gz: 3261ca8d0f8745404d7f834ac0b5c797b9d6cd4a019d57fd94ad9d82cff0ba47c7a6f7e5dab8e97b84112dfd1ca60635d2ec93221b1efbb9fe59c77c3cacabe4
7
- data.tar.gz: 4ed825dbe16e819e534f39cd5b3bdba3bea9c1e2d41b2c59db9cb67deb88c4f2706089c6e602dbd88f78d9a10fb1483a96b56764f34ea9dfd732bcc2b6410123
6
+ metadata.gz: b394dff8f98f303a58c4538f47c4d54a6ee6458f7037b108fde6700a53bad00855601552eef3cf6cda8cea62147241c5c5dc484728a97ad75058dc7f9e7a31d1
7
+ data.tar.gz: f7366c3d64043b3633f141d1db82f08f9a1aea9a681b527649f04bab87e29802d7f17a877efdcf3e7793be71e4fbcc6579ec38f2c18392251fd97d451a125687
data/lib/imageparser.rb CHANGED
@@ -16,11 +16,21 @@ class ImageParser
16
16
  # Parse a PPM file.
17
17
  #
18
18
  # Add parsed results into the hash `info`.
19
+ #
19
20
  # These results are, the header, the width, the height, the RGB max value, the raster and the raster grid.
20
21
  # Example: parse_ppm(hash)
21
- # => hash[:header] = "P6", hash[:width] = 4, hash[:height] = 4, hash[:rgb] = 255,
22
- # => hash[:raster] = [255, 42, 55, ..], hash[:raster_grid] = [[34, 43, 55], ..]
23
-
22
+ #
23
+ # hash[:header] = "P6"
24
+ #
25
+ # hash[:width] = 4
26
+ #
27
+ # hash[:height] = 4
28
+ #
29
+ # hash[:rgb] = 255
30
+ #
31
+ # hash[:raster] = [255, 42, 55, ..]
32
+ #
33
+ # hash[:raster_grid] = [[34, 43, 55], ..]
24
34
  def parse_ppm(info)
25
35
  info[:header] = @con.split(" ")[0] if @con.split(" ")[0] == "P6"
26
36
  info[:width] = @con.split(" ")[1].to_i if @con.split(" ")[1].to_i > 0
@@ -33,9 +43,14 @@ class ImageParser
33
43
  # Parse a PTF file.
34
44
  #
35
45
  # Add parsed results into hash `info`.
46
+ #
36
47
  # These results are, the header and the color information.
48
+ #
37
49
  # Example: parse_ptf(hash)
38
- # hash[:header] = "PTF1", hash[:color_info] = [3, 2, 33, 3]
50
+ #
51
+ # hash[:header] = "PTF1"
52
+ #
53
+ # hash[:color_info] = [3, 2, 33, 3]
39
54
  def parse_ptf(info)
40
55
  info[:header] = @con.split(" ")[0] if @con.split(" ")[0] == "PTF1"
41
56
  info[:color_info] = @con.split(",")[1..-1].map {|s| s.delete ' '}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imageparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Himpon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Image Parsing Gem for PPM and PTF files.
14
14
  email: synattack@hotmail.com