Skip to content

Commit 1a72469

Browse files
committed
Add detailed docstrings for String class and its methods to enhance documentation and clarify functionality.
1 parent 44126b4 commit 1a72469

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

pyvalueobjects/strings/string.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33

44

55
class String(ValueObject):
6+
"""
7+
A value object representing a string. Inherits from ValueObject and validates that the input is a string.
8+
"""
69

710
_ALLOWED_INPUT_TYPES = {str, int, float, bool}
811

912
def __init__(self, value: str):
13+
"""
14+
Initialize the String object with the given string value.
15+
:param value: A string value.
16+
"""
1017
super().__init__(value)
1118

1219
def _validate(self, value):
20+
"""
21+
Validate that the given value is a string.
22+
:param value: The value to validate.
23+
:raises: ValueObjectError if the value is not a string.
24+
"""
1325
super()._validate(value)
1426
input_type = type(value)
1527
if input_type != str:

0 commit comments

Comments
 (0)