Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jzombie committed Apr 3, 2024
1 parent 373be8e commit 81c9a61
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@ Install `EnumWithDict` using pip:
pip install enum_with_dict
```

## Usage

### Defining an Enum with `EnumWithDict`

```python
from enum_with_dict import EnumWithDict

class Color(EnumWithDict):
RED = 'red'
GREEN = 'green'
BLUE = 'blue'

```

### Converting an Enum to a Dictionary

```python
color_dict = Color.to_dict()
print(color_dict)
# Output: {'RED': 'red', 'GREEN': 'green', 'BLUE': 'blue'}
```

### Getting the Initial Enum Value

```python
initial_color = Color.get_initial()
print(initial_color)
# Output: 'red'
```

## LICENSE

[MIT](LICENSE)
`EnumWithDict` is released under the MIT License. See the [LICENSE](LICENSE) file for more details.

0 comments on commit 81c9a61

Please sign in to comment.