Coverage for src / rtflite / encoding / engine.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-08 04:50 +0000

1"""RTF encoding engine for orchestrating document generation.""" 

2 

3from typing import TYPE_CHECKING 

4 

5from .unified_encoder import UnifiedRTFEncoder 

6 

7if TYPE_CHECKING: 

8 from ..encode import RTFDocument 

9 

10 

11class RTFEncodingEngine: 

12 """Main engine for RTF document encoding. 

13 

14 This class orchestrates the encoding process using the UnifiedRTFEncoder 

15 which implements the strategy pattern for pagination and rendering. 

16 """ 

17 

18 def __init__(self): 

19 self._encoder = UnifiedRTFEncoder() 

20 

21 def encode_document(self, document: "RTFDocument") -> str: 

22 """Encode an RTF document using the unified encoder. 

23 

24 Args: 

25 document: The RTF document to encode 

26 

27 Returns: 

28 Complete RTF string 

29 """ 

30 return self._encoder.encode(document)