Class: Value::Color
- Inherits:
-
Object
- Object
- Value::Color
- Defined in:
- lib/scss_lint/sass/script.rb
Overview
When linting colors, it’s convenient to be able to inspect the original color string. This adds an attribute to the Color to keep track of the original string and provides a method which the modified lexer can use to set it.
Instance Attribute Summary collapse
-
#original_string ⇒ Object
Returns the value of attribute original_string.
Class Method Summary collapse
Instance Attribute Details
#original_string ⇒ Object
Returns the value of attribute original_string.
64 65 66 |
# File 'lib/scss_lint/sass/script.rb', line 64 def original_string @original_string end |
Class Method Details
.from_string(string, rgb = nil) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/scss_lint/sass/script.rb', line 66 def self.from_string(string, rgb = nil) unless rgb rgb = string.scan(/^#(..?)(..?)(..?)$/). first. map { |hex| hex.ljust(2, hex).to_i(16) } end color = new(rgb, false) color.original_string = string color end |