Class: RubyMarks::Group

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, recognizer) {|_self| ... } ⇒ Group

Returns a new instance of Group.

Yields:

  • (_self)

Yield Parameters:



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

def initialize(label, recognizer)
  @label = label
  @recognizer = recognizer
  
  @mark_width  = @recognizer.config.default_mark_width
  @mark_height = @recognizer.config.default_mark_height

  @mark_width_tolerance  = @recognizer.config.default_mark_width_tolerance
  @mark_height_tolerance = @recognizer.config.default_mark_height_tolerance

  @marks_options = @recognizer.config.default_marks_options
  @distance_between_marks = @recognizer.config.default_distance_between_marks

  @expected_lines = @recognizer.config.default_expected_lines
  @expected_coordinates = {}
  yield self if block_given?
end

Instance Attribute Details

#coordinatesObject

Returns the value of attribute coordinates.



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

def coordinates
  @coordinates
end

#distance_between_marksObject

Returns the value of attribute distance_between_marks.



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

def distance_between_marks
  @distance_between_marks
end

#expected_coordinatesObject

Returns the value of attribute expected_coordinates.



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

def expected_coordinates
  @expected_coordinates
end

#labelObject (readonly)

Returns the value of attribute label.



5
6
7
# File 'lib/ruby_marks/group.rb', line 5

def label
  @label
end

#mark_heightObject

Returns the value of attribute mark_height.



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

def mark_height
  @mark_height
end

#mark_height_toleranceObject

Returns the value of attribute mark_height_tolerance.



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

def mark_height_tolerance
  @mark_height_tolerance
end

#mark_widthObject

Returns the value of attribute mark_width.



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

def mark_width
  @mark_width
end

#mark_width_toleranceObject

Returns the value of attribute mark_width_tolerance.



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

def mark_width_tolerance
  @mark_width_tolerance
end

#marksObject

Returns the value of attribute marks.



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

def marks
  @marks
end

#marks_optionsObject

Returns the value of attribute marks_options.



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

def marks_options
  @marks_options
end

#recognizerObject (readonly)

Returns the value of attribute recognizer.



5
6
7
# File 'lib/ruby_marks/group.rb', line 5

def recognizer
  @recognizer
end

Instance Method Details

#incorrect_expected_linesObject



29
30
31
# File 'lib/ruby_marks/group.rb', line 29

def incorrect_expected_lines
  @expected_lines != marks.count
end

#mark_height_tolerance_rangeObject



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

def mark_height_tolerance_range
  mark_height_with_down_tolerance..mark_height_with_up_tolerance
end

#mark_height_with_down_toleranceObject



43
44
45
# File 'lib/ruby_marks/group.rb', line 43

def mark_height_with_down_tolerance
  @mark_height - @mark_height_tolerance
end

#mark_height_with_up_toleranceObject



48
49
50
# File 'lib/ruby_marks/group.rb', line 48

def mark_height_with_up_tolerance
  @mark_height + @mark_height_tolerance
end

#mark_width_tolerance_rangeObject



53
54
55
# File 'lib/ruby_marks/group.rb', line 53

def mark_width_tolerance_range
  mark_width_with_down_tolerance..mark_width_with_up_tolerance
end

#mark_width_with_down_toleranceObject



33
34
35
# File 'lib/ruby_marks/group.rb', line 33

def mark_width_with_down_tolerance
  @mark_width - @mark_width_tolerance
end

#mark_width_with_up_toleranceObject



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

def mark_width_with_up_tolerance
  @mark_width + @mark_width_tolerance
end