Class: W3CValidators::Message
- Inherits:
-
Object
- Object
- W3CValidators::Message
- Defined in:
- lib/w3c_validators/message.rb
Constant Summary collapse
- MESSAGE_TYPES =
[:warning, :error]
Instance Attribute Summary collapse
-
#col ⇒ Object
Returns the value of attribute col.
-
#context ⇒ Object
Returns the value of attribute context.
-
#element ⇒ Object
Returns the value of attribute element.
-
#explanation ⇒ Object
Returns the value of attribute explanation.
-
#line ⇒ Object
Returns the value of attribute line.
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_count ⇒ Object
Returns the value of attribute message_count.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#skippedstring ⇒ Object
Returns the value of attribute skippedstring.
-
#source ⇒ Object
Returns the value of attribute source.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(uri, message_type, options = {}) ⇒ Message
constructor
Due to the responses received from the W3C’s validators, different data are available for different validation types.
- #is_error? ⇒ Boolean
- #is_warning? ⇒ Boolean
-
#to_s ⇒ Object
Return the message as a string.
Constructor Details
#initialize(uri, message_type, options = {}) ⇒ Message
Due to the responses received from the W3C’s validators, different data are available for different validation types.
Feed validation
-
line
-
col
-
message
(originallytext
) -
message_count
-
element
-
parent
-
value
See validator.w3.org/feed/docs/soap.html#soap12message for full explanations.
Markup validation
-
line
-
col
-
message
-
message_id
-
explanation
-
source
See validator.w3.org/docs/api.html#soap12message for full explanations.
CSS validation (jigsaw.w3.org/css-validator/api.html#soap12message)
-
level
-
line
-
message
-
context
-
skippedstring
See jigsaw.w3.org/css-validator/api.html#soap12message for full explanations.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/w3c_validators/message.rb', line 37 def initialize(uri, , = {}) @type = @uri = uri # All validators @line = [:line] @col = [:col] # MarkupValidator @source = [:source] @explanation = [:explanation] @message = [:message] @message_id = [:messageid] # FeedValidator @message = [:text] unless @message @message_count = [:message_count] @element = [:element] @parent = [:parent] @value = [:value] # CSSValidator @level = [:level] @context = [:context].strip if [:context] @skippedstring = [:skippedstring].strip if [:skippedstring] end |
Instance Attribute Details
#col ⇒ Object
Returns the value of attribute col.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def col @col end |
#context ⇒ Object
Returns the value of attribute context.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def context @context end |
#element ⇒ Object
Returns the value of attribute element.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def element @element end |
#explanation ⇒ Object
Returns the value of attribute explanation.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def explanation @explanation end |
#line ⇒ Object
Returns the value of attribute line.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def line @line end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def @message end |
#message_count ⇒ Object
Returns the value of attribute message_count.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def @message_count end |
#message_id ⇒ Object
Returns the value of attribute message_id.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def @message_id end |
#parent ⇒ Object
Returns the value of attribute parent.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def parent @parent end |
#skippedstring ⇒ Object
Returns the value of attribute skippedstring.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def skippedstring @skippedstring end |
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def source @source end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/w3c_validators/message.rb', line 3 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/w3c_validators/message.rb', line 4 def value @value end |
Instance Method Details
#is_error? ⇒ Boolean
68 69 70 |
# File 'lib/w3c_validators/message.rb', line 68 def is_error? @type == :error end |
#is_warning? ⇒ Boolean
64 65 66 |
# File 'lib/w3c_validators/message.rb', line 64 def is_warning? @type == :warning end |
#to_s ⇒ Object
Return the message as a string.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/w3c_validators/message.rb', line 73 def to_s str = @type.to_s.upcase if @uri and not @uri.empty? str << "; URI: #{@uri}" end str << "; line #{@line}" if @message and not @message.empty? str << ": #{@message}" end return str end |