Class: Ledstrip::Led
- Inherits:
-
Object
- Object
- Ledstrip::Led
- Defined in:
- lib/ledstrip/led.rb
Instance Attribute Summary collapse
-
#b ⇒ Object
Returns the value of attribute b.
-
#g ⇒ Object
Returns the value of attribute g.
-
#r ⇒ Object
Returns the value of attribute r.
Instance Method Summary collapse
- #blue=(value) ⇒ Object
- #green=(value) ⇒ Object
-
#initialize(r: 0, g: 0, b: 0) ⇒ Led
constructor
A new instance of Led.
- #red=(value) ⇒ Object
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
#b ⇒ Object
Returns the value of attribute b.
4 5 6 |
# File 'lib/ledstrip/led.rb', line 4 def b @b end |
#g ⇒ Object
Returns the value of attribute g.
4 5 6 |
# File 'lib/ledstrip/led.rb', line 4 def g @g end |
#r ⇒ Object
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 |