Module: RubyMarks

Extended by:
RubyMarks
Included in:
RubyMarks
Defined in:
lib/ruby_marks.rb,
lib/ruby_marks/mark.rb,
lib/ruby_marks/group.rb,
lib/ruby_marks/config.rb,
lib/ruby_marks/support.rb,
lib/ruby_marks/version.rb,
lib/ruby_marks/watcher.rb,
lib/ruby_marks/flood_scan.rb,
lib/ruby_marks/recognizer.rb,
lib/ruby_marks/image_utils.rb

Defined Under Namespace

Classes: Config, FloodScan, Group, ImageUtils, Mark, Recognizer, Watcher

Constant Summary collapse

COLORS =
%w{ #d80000 
#00d8d8 
#d8006c 
#d86c00 
#006cd8 
#00d86c 
#d8d800 
#00d86c 
#6c00d8 
#a5a500
#a27b18 
#18a236 
#df4f27 }
AVAILABLE_WATCHERS =
[
  :scan_mark_watcher,
  :scan_unmarked_watcher,
  :scan_multiple_marked_watcher,
  :incorrect_group_watcher,
  :timed_out_watcher
]
VERSION =
"1.0.0".freeze
@@edge_level =
4
@@threshold_level =
60
@@scan_timeout =
0
@@default_block_width_tolerance =
100
@@default_block_height_tolerance =
100
@@default_mark_width_tolerance =
4
@@default_mark_height_tolerance =
4
@@default_mark_width =
20
@@default_mark_height =
20
@@intensity_percentual =
50
@@default_marks_options =
%w{A B C D E}
@@default_distance_between_marks =
25
@@default_expected_lines =
20

Instance Method Summary collapse

Instance Method Details

#mattr_accessor(*syms) ⇒ Object



44
45
46
47
# File 'lib/ruby_marks/support.rb', line 44

def mattr_accessor(*syms)
  mattr_reader(*syms)
  mattr_writer(*syms)
end

#mattr_reader(*syms) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby_marks/support.rb', line 4

def mattr_reader(*syms)
  syms.each do |sym|
    next if sym.is_a?(Hash)
    class_eval(<<-EOS, __FILE__, __LINE__)
      unless defined? @@#{sym}
        @@#{sym} = nil
      end
      
      def self.#{sym}
        @@#{sym}
      end

      def #{sym}
        @@#{sym}
      end
    EOS
  end
end

#mattr_writer(*syms) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ruby_marks/support.rb', line 23

def mattr_writer(*syms)
  options = syms.last.is_a?(::Hash) ? pop : {}
  syms.each do |sym|
    class_eval(<<-EOS, __FILE__, __LINE__)
      unless defined? @@#{sym}
        @@#{sym} = nil
      end
      
      def self.#{sym}=(obj)
        @@#{sym} = obj
      end
      
      #{"
      def #{sym}=(obj)
        @@#{sym} = obj
      end
      " unless options[:instance_writer] == false }
    EOS
  end
end