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.



180
181
182
183
# File 'lib/coradoc/validation.rb', line 180

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



178
179
180
# File 'lib/coradoc/validation.rb', line 178

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



178
179
180
# File 'lib/coradoc/validation.rb', line 178

def options
  @options
end

Instance Method Details

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

Raises:

  • (NotImplementedError)


185
186
187
# File 'lib/coradoc/validation.rb', line 185

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