Class: Houston::ColorValue
- Inherits:
-
Object
- Object
- Houston::ColorValue
- Defined in:
- lib/houston/boot/configuration.rb
Instance Attribute Summary collapse
-
#hex ⇒ Object
readonly
Returns the value of attribute hex.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(name, hex) ⇒ ColorValue
constructor
A new instance of ColorValue.
- #rgb ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, hex) ⇒ ColorValue
Returns a new instance of ColorValue.
423 424 425 426 |
# File 'lib/houston/boot/configuration.rb', line 423 def initialize(name, hex) @name = name @hex = hex end |
Instance Attribute Details
#hex ⇒ Object (readonly)
Returns the value of attribute hex.
421 422 423 |
# File 'lib/houston/boot/configuration.rb', line 421 def hex @hex end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
420 421 422 |
# File 'lib/houston/boot/configuration.rb', line 420 def name @name end |
Instance Method Details
#as_json(options = {}) ⇒ Object
428 429 430 |
# File 'lib/houston/boot/configuration.rb', line 428 def as_json(={}) name end |
#rgb ⇒ Object
436 437 438 |
# File 'lib/houston/boot/configuration.rb', line 436 def rgb "rgb(#{@hex.scan(/../).map { |s| s.to_i(16) }.join(", ")})" end |
#to_s ⇒ Object
432 433 434 |
# File 'lib/houston/boot/configuration.rb', line 432 def to_s name end |