diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-10-10 02:54:41 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-10-10 02:54:41 -0700 |
| commit | b02cc8d49513cdcc54f4421e71db3512354d4e2e (patch) | |
| tree | 2a3a83e1f99a1108eedb703d2cf8ed43613b2c22 /ricky/param/selections.py | |
| parent | 52d85ddcb9c934ec4dc0e890633762bfa2ff51f5 (diff) | |
renamed options to selections
Diffstat (limited to 'ricky/param/selections.py')
| -rw-r--r-- | ricky/param/selections.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ricky/param/selections.py b/ricky/param/selections.py new file mode 100644 index 0000000..303c92e --- /dev/null +++ b/ricky/param/selections.py @@ -0,0 +1,21 @@ +from ricky.param.option import Selection +import sys +class Selections: + def __init__(self, *args): + self._values = args + def __iter__(self): + return iter(self._values) + def __len__(self): + return len(self._values) + def __str__(self): + return str(self._values) + def __getitem__(self, i): + return self._values[i] + def search(self, s): + for i in self: + if str(s) in i.value: + return i + @classmethod + def from_dict(cls, *args): + selections = map(lambda x: Selection(**x), args); + return cls(*selections); |
