class RubyMarks::Mark

Attributes

coordinates[RW]
distance_from_previous[RW]
group[RW]
image_str[RW]
line[RW]
position[RW]

Public Class Methods

new(params={}) click to toggle source
# File lib/ruby_marks/mark.rb, line 7
def initialize(params={})
  params.each do |k, v|
    self.send("#{k}=", v) if self.respond_to?("#{k}=")
  end
end

Public Instance Methods

intensity() click to toggle source
# File lib/ruby_marks/mark.rb, line 19
def intensity
  if @image_str
    colors = []

    @image_str.each do |y|
      y.each do |x|
        colors << x
      end
    end

    intensity = colors.count(".") * 100 / colors.size
  end
end
marked?() click to toggle source
# File lib/ruby_marks/mark.rb, line 13
def marked?
  if @image_str
    return intensity >= @group.recognizer.config.intensity_percentual
  end
end
unmarked?() click to toggle source
# File lib/ruby_marks/mark.rb, line 33
def unmarked?
  !marked?
end
value() click to toggle source
# File lib/ruby_marks/mark.rb, line 37
def value 
  if @group
    position = @group.marks[line].index(self)
    
    values = @group.marks_options
    return position && values[position]
  end
end