Class: Mir::Rgb
- Inherits:
-
Object
- Object
- Mir::Rgb
- Defined in:
- lib/mir/01_model.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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(r, g, b) ⇒ Rgb
constructor
A new instance of Rgb.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(r, g, b) ⇒ Rgb
Returns a new instance of Rgb.
17 18 19 |
# File 'lib/mir/01_model.rb', line 17 def initialize r,g,b @r,@g,@b=r,g,b end |
Instance Attribute Details
#b ⇒ Object
Returns the value of attribute b.
16 17 18 |
# File 'lib/mir/01_model.rb', line 16 def b @b end |
#g ⇒ Object
Returns the value of attribute g.
16 17 18 |
# File 'lib/mir/01_model.rb', line 16 def g @g end |
#r ⇒ Object
Returns the value of attribute r.
16 17 18 |
# File 'lib/mir/01_model.rb', line 16 def r @r end |
Class Method Details
Instance Method Details
#to_a ⇒ Object
21 22 23 |
# File 'lib/mir/01_model.rb', line 21 def to_a [self.r,self.g,self.b] end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/mir/01_model.rb', line 25 def to_s "(#{r.to_s.rjust(3)},#{g.to_s.rjust(3)},#{b.to_s.rjust(3)})" end |