Class: Uniword::Validation::Rules::ModelContext
- Inherits:
-
Object
- Object
- Uniword::Validation::Rules::ModelContext
- Defined in:
- lib/uniword/validation/rules/model_context.rb
Overview
In-memory validation context: wraps a document model.
Counterpart to DocumentContext (which wraps an on-disk DOCX package). Model-level rules consume this context via the Engine.
Instance Attribute Summary collapse
-
#document ⇒ Wordprocessingml::DocumentRoot
readonly
The document model.
Instance Method Summary collapse
-
#context_type ⇒ Symbol
Context type used by the Engine to select rules.
-
#initialize(document) ⇒ ModelContext
constructor
A new instance of ModelContext.
Constructor Details
#initialize(document) ⇒ ModelContext
Returns a new instance of ModelContext.
19 20 21 |
# File 'lib/uniword/validation/rules/model_context.rb', line 19 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Wordprocessingml::DocumentRoot (readonly)
Returns the document model.
16 17 18 |
# File 'lib/uniword/validation/rules/model_context.rb', line 16 def document @document end |
Instance Method Details
#context_type ⇒ Symbol
Context type used by the Engine to select rules.
26 27 28 |
# File 'lib/uniword/validation/rules/model_context.rb', line 26 def context_type :model end |