Class: Tone

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(red, green, blue, gray = 0) ⇒ Tone

Returns a new instance of Tone


30
31
32
# File 'lib/tone.rb', line 30

def initialize(red, green, blue, gray=0)
  set red, green, blue, gray
end

Instance Attribute Details

#blueObject

Returns the value of attribute blue


2
3
4
# File 'lib/tone.rb', line 2

def blue
  @blue
end

#grayObject

Returns the value of attribute gray


2
3
4
# File 'lib/tone.rb', line 2

def gray
  @gray
end

#greenObject

Returns the value of attribute green


2
3
4
# File 'lib/tone.rb', line 2

def green
  @green
end

#redObject

Returns the value of attribute red


2
3
4
# File 'lib/tone.rb', line 2

def red
  @red
end

Instance Method Details

#set(red, green, blue, gray = 0) ⇒ Object

Sets all components at once.


35
36
37
38
39
40
# File 'lib/tone.rb', line 35

def set(red, green, blue, gray=0)
  self.red   = red
  self.green = green
  self.blue  = blue
  self.gray  = gray
end