Class: RubyMarks::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_marks/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recognizer) ⇒ Config

Returns a new instance of Config.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ruby_marks/config.rb', line 11

def initialize(recognizer)
  @recognizer = recognizer
  @threshold_level = RubyMarks.threshold_level
  
  @intensity_percentual = RubyMarks.intensity_percentual
  @recognition_colors   = RubyMarks.recognition_colors

  @expected_clocks_count = RubyMarks.expected_clocks_count
  @clock_marks_scan_x = RubyMarks.clock_marks_scan_x
  @clock_width  = RubyMarks.clock_width
  @clock_height = RubyMarks.clock_height
  @clock_mark_size_tolerance = RubyMarks.clock_mark_size_tolerance
  
  @default_mark_width  = RubyMarks.default_mark_width
  @default_mark_height = RubyMarks.default_mark_height
  @default_marks_options = RubyMarks.default_marks_options
  @default_distance_between_marks = RubyMarks.default_distance_between_marks
end

Instance Attribute Details

#clock_heightObject

Returns the value of attribute clock_height.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def clock_height
  @clock_height
end

#clock_mark_size_toleranceObject

Returns the value of attribute clock_mark_size_tolerance.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def clock_mark_size_tolerance
  @clock_mark_size_tolerance
end

#clock_marks_scan_xObject

Returns the value of attribute clock_marks_scan_x.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def clock_marks_scan_x
  @clock_marks_scan_x
end

#clock_widthObject

Returns the value of attribute clock_width.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def clock_width
  @clock_width
end

#default_distance_between_marksObject

Returns the value of attribute default_distance_between_marks.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def default_distance_between_marks
  @default_distance_between_marks
end

#default_mark_heightObject

Returns the value of attribute default_mark_height.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def default_mark_height
  @default_mark_height
end

#default_mark_widthObject

Returns the value of attribute default_mark_width.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def default_mark_width
  @default_mark_width
end

#default_marks_optionsObject

Returns the value of attribute default_marks_options.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def default_marks_options
  @default_marks_options
end

#expected_clocks_countObject

Returns the value of attribute expected_clocks_count.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def expected_clocks_count
  @expected_clocks_count
end

#intensity_percentualObject

Returns the value of attribute intensity_percentual.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def intensity_percentual
  @intensity_percentual
end

#recognition_colorsObject

Returns the value of attribute recognition_colors.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def recognition_colors
  @recognition_colors
end

#threshold_levelObject

Returns the value of attribute threshold_level.



6
7
8
# File 'lib/ruby_marks/config.rb', line 6

def threshold_level
  @threshold_level
end

Instance Method Details

#calculated_threshold_levelObject



30
31
32
# File 'lib/ruby_marks/config.rb', line 30

def calculated_threshold_level
  Magick::QuantumRange * (@threshold_level.to_f / 100)
end

#clock_height_tolerance_rangeObject



54
55
56
# File 'lib/ruby_marks/config.rb', line 54

def clock_height_tolerance_range
  clock_height_with_down_tolerance..clock_height_with_up_tolerance
end

#clock_height_with_down_toleranceObject



42
43
44
# File 'lib/ruby_marks/config.rb', line 42

def clock_height_with_down_tolerance
  @clock_height - @clock_mark_size_tolerance
end

#clock_height_with_up_toleranceObject



46
47
48
# File 'lib/ruby_marks/config.rb', line 46

def clock_height_with_up_tolerance
  @clock_height + @clock_mark_size_tolerance
end

#clock_width_tolerance_rangeObject



50
51
52
# File 'lib/ruby_marks/config.rb', line 50

def clock_width_tolerance_range
  clock_width_with_down_tolerance..clock_width_with_up_tolerance
end

#clock_width_with_down_toleranceObject



34
35
36
# File 'lib/ruby_marks/config.rb', line 34

def clock_width_with_down_tolerance
  @clock_width - @clock_mark_size_tolerance
end

#clock_width_with_up_toleranceObject



38
39
40
# File 'lib/ruby_marks/config.rb', line 38

def clock_width_with_up_tolerance
  @clock_width + @clock_mark_size_tolerance
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



63
64
65
# File 'lib/ruby_marks/config.rb', line 63

def configure
  yield self if block_given?
end

#define_group(group_label, &block) ⇒ Object



58
59
60
61
# File 'lib/ruby_marks/config.rb', line 58

def define_group(group_label, &block)
  group = RubyMarks::Group.new(group_label, @recognizer, &block)
  @recognizer.add_group(group)
end