ruby_marks 0.0.4.dev → 0.0.5.dev

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  #encoding: utf-8
2
2
  module RubyMarks
3
-
3
+
4
4
  class Config
5
5
 
6
6
  attr_accessor :clock_marks_scan_x, :intensity_percentual, :recognition_colors, :default_marks_options,
@@ -8,11 +8,11 @@ module RubyMarks
8
8
 
9
9
  def initialize(document)
10
10
  @document = document
11
- @clock_marks_scan_x = @@clock_marks_scan_x
12
- @intensity_percentual = @@intensity_percentual
13
- @recognition_colors = @@recognition_colors
14
- @default_marks_options = @@default_marks_options
15
- @default_distance_between_marks = @@default_distance_between_marks
11
+ @clock_marks_scan_x = RubyMarks.clock_marks_scan_x
12
+ @intensity_percentual = RubyMarks.intensity_percentual
13
+ @recognition_colors = RubyMarks.recognition_colors
14
+ @default_marks_options = RubyMarks.default_marks_options
15
+ @default_distance_between_marks = RubyMarks.default_distance_between_marks
16
16
  end
17
17
 
18
18
  def define_group(group_label, &block)
@@ -0,0 +1,48 @@
1
+ module RubyMarks
2
+ extend self
3
+
4
+ def mattr_reader(*syms)
5
+ syms.each do |sym|
6
+ next if sym.is_a?(Hash)
7
+ class_eval(<<-EOS, __FILE__, __LINE__)
8
+ unless defined? @@#{sym}
9
+ @@#{sym} = nil
10
+ end
11
+
12
+ def self.#{sym}
13
+ @@#{sym}
14
+ end
15
+
16
+ def #{sym}
17
+ @@#{sym}
18
+ end
19
+ EOS
20
+ end
21
+ end
22
+
23
+ def mattr_writer(*syms)
24
+ options = syms.last.is_a?(::Hash) ? pop : {}
25
+ syms.each do |sym|
26
+ class_eval(<<-EOS, __FILE__, __LINE__)
27
+ unless defined? @@#{sym}
28
+ @@#{sym} = nil
29
+ end
30
+
31
+ def self.#{sym}=(obj)
32
+ @@#{sym} = obj
33
+ end
34
+
35
+ #{"
36
+ def #{sym}=(obj)
37
+ @@#{sym} = obj
38
+ end
39
+ " unless options[:instance_writer] == false }
40
+ EOS
41
+ end
42
+ end
43
+
44
+ def mattr_accessor(*syms)
45
+ mattr_reader(*syms)
46
+ mattr_writer(*syms)
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyMarks
2
- VERSION = "0.0.4.dev".freeze
2
+ VERSION = "0.0.5.dev".freeze
3
3
  end
data/lib/ruby_marks.rb CHANGED
@@ -1,12 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'RMagick'
3
- require 'ruby_marks/document'
4
- require 'ruby_marks/config'
5
- require 'ruby_marks/clock_mark'
6
- require 'ruby_marks/group'
7
- require 'ruby_marks/rgb'
8
3
  require 'ruby_marks/version'
9
-
4
+ require 'ruby_marks/support'
10
5
 
11
6
  magick_version = `convert -version`
12
7
 
@@ -18,12 +13,25 @@ if magick_version =~ /Q16/
18
13
  }
19
14
  end
20
15
 
21
- @@clock_marks_scan_x = 62
16
+ module RubyMarks
17
+ mattr_accessor :clock_marks_scan_x
18
+ @@clock_marks_scan_x = 62
22
19
 
23
- @@intensity_percentual = 40
20
+ mattr_accessor :intensity_percentual
21
+ @@intensity_percentual = 40
24
22
 
25
- @@recognition_colors = ["#000000"]
23
+ mattr_accessor :recognition_colors
24
+ @@recognition_colors = ["#000000"]
26
25
 
27
- @@default_marks_options = %w{A B C D E}
26
+ mattr_accessor :default_marks_options
27
+ @@default_marks_options = %w{A B C D E}
28
28
 
29
- @@default_distance_between_marks = 25
29
+ mattr_accessor :default_distance_between_marks
30
+ @@default_distance_between_marks = 25
31
+ end
32
+
33
+ require 'ruby_marks/document'
34
+ require 'ruby_marks/config'
35
+ require 'ruby_marks/clock_mark'
36
+ require 'ruby_marks/group'
37
+ require 'ruby_marks/rgb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_marks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.dev
4
+ version: 0.0.5.dev
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -42,6 +42,7 @@ files:
42
42
  - lib/ruby_marks/document.rb
43
43
  - lib/ruby_marks/group.rb
44
44
  - lib/ruby_marks/rgb.rb
45
+ - lib/ruby_marks/support.rb
45
46
  - lib/ruby_marks/version.rb
46
47
  - lib/ruby_marks.rb
47
48
  - README.rdoc