Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string2color.rb
Overview
Add on to string class
Instance Method Summary collapse
Instance Method Details
#to_color ⇒ Object
5 6 7 |
# File 'lib/string2color.rb', line 5 def to_color "RGB(#{val_1}, #{val_2}, #{val_3})" end |
#val_1 ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/string2color.rb', line 9 def val_1 size if size <= 10 size * 9 elsif size > 10 && size <= 90 size * 2 end end |
#val_2 ⇒ Object
18 19 20 |
# File 'lib/string2color.rb', line 18 def val_2 self[2].ord end |
#val_3 ⇒ Object
22 23 24 |
# File 'lib/string2color.rb', line 22 def val_3 self[/./].ord end |