diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst index 58aa320..f9b4aed 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -181,6 +181,20 @@ Representing a version (the Version class) :attr:`prerelease` component: it's the smallest "pure" patch version strictly greater than that version. + .. method:: truncate(self, level='patch']): + + Returns a similar level, but truncated at the provided level. + + .. code-block:: pycon + + >>> Version('1.0.2-rc1+b43.24').truncate() + Version('1.0.2') + >>> Version('1.0.2-rc1+b43.24').truncate('minor') + Version('1.0.0') + >>> Version('1.0.2-rc1+b43.24').truncate('prerelease') + Version('1.0.2-rc1') + + .. method:: __iter__(self) Iterates over the version components (:attr:`major`, :attr:`minor`, |