Class: Ledstrip::Led

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(r: 0, g: 0, b: 0) ⇒ Led

Returns a new instance of Led.



6
7
8
# File 'lib/ledstrip/led.rb', line 6

def initialize(r: 0, g: 0, b: 0)
  @r, @g, @b = r.to_i, g.to_i, b.to_i
end

Instance Attribute Details

#bObject

Returns the value of attribute b.



4
5
6
# File 'lib/ledstrip/led.rb', line 4

def b
  @b
end

#gObject

Returns the value of attribute g.



4
5
6
# File 'lib/ledstrip/led.rb', line 4

def g
  @g
end

#rObject

Returns the value of attribute r.



4
5
6
# File 'lib/ledstrip/led.rb', line 4

def r
  @r
end

Instance Method Details

#blue=(value) ⇒ Object



12
# File 'lib/ledstrip/led.rb', line 12

def blue=(value);  @b = value.to_i; end

#green=(value) ⇒ Object



11
# File 'lib/ledstrip/led.rb', line 11

def green=(value); @g = value.to_i; end

#red=(value) ⇒ Object



10
# File 'lib/ledstrip/led.rb', line 10

def red=(value);   @r = value.to_i; end