Class: Kracker::Zooka::Tolerance

Inherits:
Object
  • Object
show all
Defined in:
lib/kracker/zooka/tolerance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTolerance

Returns a new instance of Tolerance.



6
7
8
9
10
11
12
13
14
# File 'lib/kracker/zooka/tolerance.rb', line 6

def initialize
  @red = 16
  @green = 16
  @blue = 16
  @alpha = 16
  @min_brightness = 16
  @max_brightness = 240
  @hue = 0.3
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def alpha
  @alpha
end

#blueObject

Returns the value of attribute blue.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def blue
  @blue
end

#greenObject

Returns the value of attribute green.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def green
  @green
end

#hueObject

Returns the value of attribute hue.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def hue
  @hue
end

#max_brightnessObject

Returns the value of attribute max_brightness.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def max_brightness
  @max_brightness
end

#min_brightnessObject

Returns the value of attribute min_brightness.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def min_brightness
  @min_brightness
end

#redObject

Returns the value of attribute red.



4
5
6
# File 'lib/kracker/zooka/tolerance.rb', line 4

def red
  @red
end

Instance Method Details

#color(c) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kracker/zooka/tolerance.rb', line 16

def color(c)
  case c.downcase.to_sym
  when :alpha
    @alpha
  when :red
    @red
  when :blue
    @blue
  when :green
    @green
  when :min_brightness
    @min_brightness
  when :hue
    @hue
  else
    0
  end
end