Class: CSSLint::Result
- Inherits:
-
Object
- Object
- CSSLint::Result
- Defined in:
- lib/csslint.rb
Instance Method Summary collapse
-
#error_messages ⇒ Object
Public: A nicely formatted list of messages with their line number.
-
#initialize(messages) ⇒ Result
constructor
A new instance of Result.
-
#valid? ⇒ Boolean
Public: Did the CSS text pass CSSLint without messages?.
Constructor Details
#initialize(messages) ⇒ Result
Returns a new instance of Result.
58 59 60 |
# File 'lib/csslint.rb', line 58 def initialize() @messages = end |
Instance Method Details
#error_messages ⇒ Object
Public: A nicely formatted list of messages with their line number.
Returns an Array of Strings.
74 75 76 77 78 79 80 |
# File 'lib/csslint.rb', line 74 def # @messages may have a 'nil' as the last element if there was a catastrophic # error, so we 'compact'. @messages.compact.map {|e| "#{e['line']}:#{e['col']}: [#{ e['type'] }] #{e['message']}#{ e['evidence'] and " (#{ e['evidence'] })"}" } end |
#valid? ⇒ Boolean
Public: Did the CSS text pass CSSLint without messages?
This is the return value of the CSSLint() function.
Returns true iff CSSLint returned no error messages.
67 68 69 |
# File 'lib/csslint.rb', line 67 def valid? @messages.select { |m| m['type'] == 'error' }.length == 0 end |