Class: Coradoc::Validation::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/validation.rb

Overview

Base class for validation rules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, **options) ⇒ Rule

Returns a new instance of Rule.



220
221
222
223
# File 'lib/coradoc/validation.rb', line 220

def initialize(name, **options)
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



218
219
220
# File 'lib/coradoc/validation.rb', line 218

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



218
219
220
# File 'lib/coradoc/validation.rb', line 218

def options
  @options
end

Instance Method Details

#validate(element, context = {}) ⇒ Object

Raises:

  • (NotImplementedError)


225
226
227
# File 'lib/coradoc/validation.rb', line 225

def validate(element, context = {})
  raise NotImplementedError, 'Subclasses must implement #validate'
end