Class: SvgConform::ValidationNotice

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_conform/validation_context.rb

Overview

New class for non-error notifications

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, node:, message:, data: {}) ⇒ ValidationNotice

Returns a new instance of ValidationNotice.



533
534
535
536
537
538
# File 'lib/svg_conform/validation_context.rb', line 533

def initialize(type:, node:, message:, data: {})
  @type = type
  @node = node
  @message = message
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



531
532
533
# File 'lib/svg_conform/validation_context.rb', line 531

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message.



531
532
533
# File 'lib/svg_conform/validation_context.rb', line 531

def message
  @message
end

#nodeObject (readonly)

Returns the value of attribute node.



531
532
533
# File 'lib/svg_conform/validation_context.rb', line 531

def node
  @node
end

#typeObject (readonly)

Returns the value of attribute type.



531
532
533
# File 'lib/svg_conform/validation_context.rb', line 531

def type
  @type
end

Instance Method Details

#columnObject



544
545
546
# File 'lib/svg_conform/validation_context.rb', line 544

def column
  @node.respond_to?(:column) ? @node.column : nil
end

#lineObject



540
541
542
# File 'lib/svg_conform/validation_context.rb', line 540

def line
  @node.respond_to?(:line) ? @node.line : nil
end

#to_hObject



548
549
550
551
552
553
554
555
556
# File 'lib/svg_conform/validation_context.rb', line 548

def to_h
  {
    type: @type,
    message: @message,
    line: line,
    column: column,
    data: @data,
  }
end