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
# 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
  @marks_options = @recognizer.config.default_marks_options
  @distance_between_marks = @recognizer.config.default_distance_between_marks
  @x_distance_from_clock = 0
  @clocks_range = 0..0
  yield self if block_given?
end

Instance Attribute Details

#clocks_rangeObject

Returns the value of attribute clocks_range.



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

def clocks_range
  @clocks_range
end

#distance_between_marksObject

Returns the value of attribute distance_between_marks.



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

def distance_between_marks
  @distance_between_marks
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.



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

def mark_height
  @mark_height
end

#mark_widthObject

Returns the value of attribute mark_width.



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

def mark_width
  @mark_width
end

#marks_optionsObject

Returns the value of attribute marks_options.



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

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

#x_distance_from_clockObject

Returns the value of attribute x_distance_from_clock.



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

def x_distance_from_clock
  @x_distance_from_clock
end

Instance Method Details

#belongs_to_clock?(clock) ⇒ Boolean

Returns:

  • (Boolean)


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

def belongs_to_clock?(clock)
  if @clocks_range.is_a?(Range)
    return @clocks_range.include? clock
  end
end