Class: Gdk::Color
- Inherits:
-
Object
- Object
- Gdk::Color
- Defined in:
- lib/gdk3/color.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(red, green, blue) ⇒ Color
constructor
A new instance of Color.
- #initialize_raw ⇒ Object
Constructor Details
#initialize(red, green, blue) ⇒ Color
Returns a new instance of Color.
49 50 51 52 53 54 |
# File 'lib/gdk3/color.rb', line 49 def initialize(red, green, blue) initialize_raw self.red = red self.green = green self.blue = blue end |
Class Method Details
.parse(spec) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gdk3/color.rb', line 21 def parse(spec) succeeded, color = parse_raw(spec) unless succeeded = "Invalid color spec: <#{spec.inspect}>: " << "Color spec must be one of them: " << "\"\#rgb\", " << "\"\#rrggbb\", " << "\"\#rrggbb\", " << "\"\#rrrgggbbb\", " << "\"\#rrrrggggbbbb\"" raise ArgumentError, end color end |
.parse_raw ⇒ Object
20 |
# File 'lib/gdk3/color.rb', line 20 alias_method :parse_raw, :parse |
.try_convert(value) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gdk3/color.rb', line 36 def try_convert(value) case value when String parse(value) when Symbol parse(value.to_s) else nil end end |
Instance Method Details
#initialize_raw ⇒ Object
48 |
# File 'lib/gdk3/color.rb', line 48 alias_method :initialize_raw, :initialize |