Metadata-Version: 2.1
Name: predecessor
Version: 0.0.2
Summary: A set of useful python classes to inherit from
Home-page: https://gitlab.com/gappleto97/predecessor
Author: Gabe Appleton
Author-email: gabe@gabeappleton.me
License: LGPLv3
Description-Content-Type: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Provides-Extra: crypto
Requires-Dist: cryptography; extra == 'crypto'
Provides-Extra: serialize
Requires-Dist: u-msgpack-python; extra == 'serialize'

Predecessor
===========

Overview
--------

This set of libraries is intended to provide useful classes to inherit
from, in a way that is cross compatible between multiple languages. A
version of this library is currently available in:

-  Python (2 or 3)
-  Javascript

Singleton
---------

The singleton class provides a way to ensure you only have one instance
of a class. For instance:

.. code:: python

    from predecessor import Singleton


    class Example(Singleton):
        def __init__(self, foo, bar):
            self.foo = foo
            self.bar = bar


    a = Example(3, 8)
    b = Example(2, 9)
    a is b  # returns True
    a.foo == b.foo == 3  # returns True

Or equivalently in Javascript:

.. code:: javascript

    const Singleton = require('predecessor').Singleton;

    class Example extends Singleton {
        constructor(foo, bar)   {
            this.foo = foo;
            this.bar = bar;
        }
    }

    let a = new Example(3, 8);
    let b = new Example(2, 9);
    a === b;  // returns true
    a.foo === 3;  // returns true
    b.foo === 3;  // returns true


