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
27
28
29
# File 'lib/ruby_marks/group.rb', line 10

def initialize(label, recognizer)
  @label = label
  @recognizer = recognizer

  @block_width_tolerance  = @recognizer.config.default_block_width_tolerance
  @block_height_tolerance = @recognizer.config.default_block_height_tolerance

  @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

#block_height_toleranceObject

Returns the value of attribute block_height_tolerance.



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

def block_height_tolerance
  @block_height_tolerance
end

#block_width_toleranceObject

Returns the value of attribute block_width_tolerance.



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

def block_width_tolerance
  @block_width_tolerance
end

#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

#expected_linesObject

Returns the value of attribute expected_lines.



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

def expected_lines
  @expected_lines
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



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

def incorrect_expected_lines
  @expected_lines != marks.count
end

#mark_height_tolerance_rangeObject



61
62
63
# File 'lib/ruby_marks/group.rb', line 61

def mark_height_tolerance_range
  mark_height_with_down_tolerance..mark_height_with_up_tolerance
end

#mark_height_with_down_toleranceObject



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

def mark_height_with_down_tolerance
  @mark_height - @mark_height_tolerance
end

#mark_height_with_up_toleranceObject



51
52
53
# File 'lib/ruby_marks/group.rb', line 51

def mark_height_with_up_tolerance
  @mark_height + @mark_height_tolerance
end

#mark_width_tolerance_rangeObject



56
57
58
# File 'lib/ruby_marks/group.rb', line 56

def mark_width_tolerance_range
  mark_width_with_down_tolerance..mark_width_with_up_tolerance
end

#mark_width_with_down_toleranceObject



36
37
38
# File 'lib/ruby_marks/group.rb', line 36

def mark_width_with_down_tolerance
  @mark_width - @mark_width_tolerance
end

#mark_width_with_up_toleranceObject



41
42
43
# File 'lib/ruby_marks/group.rb', line 41

def mark_width_with_up_tolerance
  @mark_width + @mark_width_tolerance
end