mork 0.0.10 → 0.0.11

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: cdc12cd7f6628650dd014afd86ed58f415b3167b
4
- data.tar.gz: f39a614c5641b14b63cf0c7ba2f5cbda76219aff
3
+ metadata.gz: 8f6fdf479e1ce97ef698e1dfb43d571a86b580c7
4
+ data.tar.gz: 3e8f988b67a5f11bb3cb62541bfff93865c1e236
5
5
  SHA512:
6
- metadata.gz: a17ad3a56ba66c46b7b1e583ce5d7a0184e365280814dc1144c4ff4594a63451a46344cf618e0ac07f87425ed88d92d2ec634434fd93ebcee3e6fa1a8ff802d0
7
- data.tar.gz: adcdd8f1d6ca75d97dbd10f10e2195ee7203288196af55b85844352390a6275ff2c84d1464470b8619180116a8d6978b183a22ab29e5a77e1b02062149588c43
6
+ metadata.gz: 571d163c91f8ed00ce47d2423c02f22603ce1287c9e61cc62c25670156e6a08ffd931287655673a120df91e6dbc01b35d47995da592316bdb41c42b625c9461d
7
+ data.tar.gz: c604bffbb932a0657b327471f82a56b95ddfc4ce85aa0d0f18241b50b789287043906f09da73be9d70aa2d9049edb95074fb464e4c33a098472d71c0d1bea7b7
data/lib/mork/mimage.rb CHANGED
@@ -24,12 +24,13 @@ module Mork
24
24
  # draws on the Mimage a set of cell outlines
25
25
  # typically used to highlight the expected responses
26
26
  def outline!(cells, roundedness=nil)
27
+ cells = [cells] if cells.is_a? Hash
28
+ return if cells.empty?
29
+ roundedness ||= [cells[0][:h], cells[0][:w]].min / 2
27
30
  out = Magick::Draw.new
28
31
  out.stroke 'green'
29
32
  out.stroke_width 4
30
33
  out.fill_opacity 0
31
- cells = [cells] if cells.is_a? Hash
32
- roundedness ||= [cells[0][:h], cells[0][:w]].min / 2
33
34
  cells.each do |c|
34
35
  out.roundrectangle c[:x], c[:y], c[:x]+c[:w], c[:y]+c[:h], roundedness, roundedness
35
36
  out.draw @image
@@ -41,6 +42,7 @@ module Mork
41
42
  # =============
42
43
  def highlight_cells!(cells, roundedness=nil)
43
44
  cells = [cells] if cells.is_a? Hash
45
+ return if cells.empty?
44
46
  roundedness ||= [cells[0][:h], cells[0][:w]].min / 2
45
47
  cells.each do |c|
46
48
  out = Magick::Draw.new
data/lib/mork/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mork
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/mork.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["giuseppe.bertini@gmail.com"]
11
11
  s.homepage = ""
12
12
  s.summary = %q{Optical mark recognition of multiple-choice response sheets}
13
- s.description = %q{Coming soon}
13
+ s.description = %q{sorry, no docs until v.0.1.0}
14
14
  s.rubyforge_project = "mork"
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
@@ -9,18 +9,18 @@ module Mork
9
9
 
10
10
  it 'highlights the registration areas and frame' do
11
11
  sheet.highlight_reg_area
12
- sheet.write_raw 'tmp/reg_areas.jpg'
12
+ sheet.write_raw 'spec/out/reg_areas.jpg'
13
13
  end
14
14
 
15
15
  it 'should highlight all areas' do
16
16
  sheet.highlight_all
17
- sheet.write 'tmp/all_highlights.jpg'
17
+ sheet.write 'spec/out/all_highlights.jpg'
18
18
  end
19
19
 
20
20
  it 'should highlight marked cells and outline correct responses' do
21
21
  sheet.highlight_marked
22
22
  sheet.outline [[1],[1],[2],[2],[3,4],[],[0,1,2,3,4]]
23
- sheet.write 'tmp/marked_highlights.jpg'
23
+ sheet.write 'spec/out/marked_highlights.jpg'
24
24
  end
25
25
  end
26
26
 
@@ -50,7 +50,7 @@ module Mork
50
50
 
51
51
  it 'writes out average whiteness of choice cells' do
52
52
  puts "Choice threshold: #{@sheet.send :choice_threshold}"
53
- File.open('tmp/choices.txt', 'w') do |f|
53
+ File.open('spec/out/choices.txt', 'w') do |f|
54
54
  120.times do |q|
55
55
  t = (0..4).collect do |c|
56
56
  @sheet.send(:shade_of, q, c).round
@@ -59,8 +59,8 @@ module Mork
59
59
  end
60
60
  end
61
61
 
62
- mf = File.open('tmp/marked.txt', 'w')
63
- uf = File.open('tmp/unmarked.txt', 'w')
62
+ mf = File.open('spec/out/marked.txt', 'w')
63
+ uf = File.open('spec/out/unmarked.txt', 'w')
64
64
  120.times do |q|
65
65
  5.times do |c|
66
66
  shade = @sheet.send(:shade_of, q, c)
@@ -110,14 +110,14 @@ module Mork
110
110
  s2.barcode_string.should == barcode_string
111
111
  s2.barcode.should == 8608
112
112
  s2.highlight_barcode
113
- s2.write 'tmp/code_bits.jpg'
113
+ s2.write 'spec/out/code_bits.jpg'
114
114
  end
115
115
 
116
116
  it 'should read the 666 bit string' do
117
117
  s2 = SheetOMR.new('spec/samples/sheet666.jpg')
118
118
  s2.barcode.should == 666666666666
119
119
  s2.highlight_barcode
120
- s2.write 'tmp/code_bits666.jpg'
120
+ s2.write 'spec/out/code_bits666.jpg'
121
121
  end
122
122
  end
123
123
 
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Mork
4
-
5
4
  describe SheetPDF do
6
5
  let(:content) {
7
6
  {
@@ -13,7 +12,6 @@ module Mork
13
12
  code: '201.48',
14
13
  signature: 'Signature'
15
14
  }
16
-
17
15
  }
18
16
  }
19
17
 
@@ -43,45 +41,32 @@ module Mork
43
41
 
44
42
  it 'creates a basic PDF sheet' do
45
43
  s = SheetPDF.new(content)
46
- s.save('tmp/sheet.pdf')
44
+ s.save('spec/out/sheet.pdf')
47
45
  end
48
46
 
49
47
  it 'creates a basic PDF sheet with a code of 15' do
50
48
  s = SheetPDF.new(content.merge({barcode: 15}))
51
- s.save('tmp/sheet16.pdf')
49
+ s.save('spec/out/sheet16.pdf')
52
50
  end
53
51
 
54
52
  it 'creates a basic PDF sheet with a code of 666666666666' do
55
53
  s = SheetPDF.new(content.merge({barcode: 666666666666}))
56
- s.save('tmp/sheet666.pdf')
54
+ s.save('spec/out/sheet666.pdf')
57
55
  end
58
56
 
59
57
  it 'creates a PDF sheet with the maximum possible barcode' do
60
58
  s = SheetPDF.new(content.merge({barcode: 1099511627775}))
61
- s.save('tmp/maxcode.pdf')
59
+ s.save('spec/out/maxcode.pdf')
62
60
  end
63
61
 
64
62
  it 'creates a PDF sheet with 160 items' do
65
63
  s = SheetPDF.new(content.merge({choices: [5] * 160}), 'spec/samples/grid160.yml')
66
- s.save('tmp/i160.pdf')
64
+ s.save('spec/out/i160.pdf')
67
65
  end
68
66
 
69
- it 'should create a multipage pdf' do
70
- content2 = [
71
- {
72
- barcode: 18446744073,
73
- choices: [5] * 100,
74
- header: {
75
- name: 'Jane Roe',
76
- title: 'Same difficult test',
77
- code: '119.27',
78
- signature: 'Signed'
79
- }
80
- },
81
- content
82
- ]
83
- s = SheetPDF.new(content2)
84
- s.save('tmp/p2.pdf')
67
+ it 'creates a multipage pdf' do
68
+ s = SheetPDF.new([content, content, content])
69
+ s.save('spec/out/p2.pdf')
85
70
  end
86
71
  end
87
72
  end
@@ -0,0 +1,4 @@
1
+ # Ignore everything in this directory
2
+ *
3
+ # Except this file
4
+ !.gitignore
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giuseppe Bertini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: narray
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.2'
139
- description: Coming soon
139
+ description: sorry, no docs until v.0.1.0
140
140
  email:
141
141
  - giuseppe.bertini@gmail.com
142
142
  executables: []
@@ -173,6 +173,7 @@ files:
173
173
  - spec/mork/npatch_spec.rb
174
174
  - spec/mork/sheet_omr_spec.rb
175
175
  - spec/mork/sheet_pdf_spec.rb
176
+ - spec/out/.gitignore
176
177
  - spec/samples/code_sample.pdf
177
178
  - spec/samples/code_sample.png
178
179
  - spec/samples/code_zero.pdf
@@ -226,6 +227,7 @@ test_files:
226
227
  - spec/mork/npatch_spec.rb
227
228
  - spec/mork/sheet_omr_spec.rb
228
229
  - spec/mork/sheet_pdf_spec.rb
230
+ - spec/out/.gitignore
229
231
  - spec/samples/code_sample.pdf
230
232
  - spec/samples/code_sample.png
231
233
  - spec/samples/code_zero.pdf