Metadata-Version: 2.4
Name: ruletools
Version: 1.0.0
Summary: A simple Python rule-making utlity
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: loggingkit

# RuleTools

A simple Python rule-making utility

## Installation

```bash
pip install ruletools
```

## Importing

```python
import ruletools
```

## Usage

Just as an example we will use this code:

```python
rules1 = RuleSet()
```

### `add_rule()`

The function `add_rule` takes one argument: the rule you want to add to the `RuleSet` object. It adds the specified rule to the specified `RuleSet` object.

```python
rules1.add_rule(Required()) # what Required() does will be discussed later
```

### `MaxLength()`

`MaxLength` takes one argument: the maximum length you want the text to be. It adds the specified `MaxLength` rule into the specified `RuleSet` object. This uses `add_rule` to work, just like all the other rules.

```python
rules1.add_rule(MaxLength(10))
```

### `MinLength`

`MinLength` takes one argument: the minimum length you want the text to be. It adds the specified `MaxLength` rule into the specified `RuleSet` object.

```python
rules1.add_rule(MinLength(2))
```

### `IncludeNumber`

`IncludeNumber` takes no arguments. It adds the `IncludeNumber` rule to the specified `RuleSet` object, meaning the text must have numbers.

```python
rules1.add_rule(IncludeNumber())
```

### `NoNumber`

`NoNumber` takes no arguments. It adds the `NoNumber` rule into the specified `RuleSet` object, meaning the text cannot contain numbers.

```python
rules1.add_rule(NoNumber())
```

### `IncludeLetters`

`IncludeLetters` takes no arguments. It adds the `IncludeLetters` rule to the specified `RuleSet` object, meaning the text must contain letters.

```python
rules1.add_rule(IncludeLetters())
```

### `NoLetters`

`NoLetters` takes no arguments. It adds the `NoLetters` rule to the specified `RuleSet` object, meaning the text must not contain letters.

```python
rules1.add_rule(NoLetters())
```

### `IncludeSpecialChar`

`IncludeSpecialChar` takes no arguments. It adds the `IncludeSpecialChar` rule to the specified `RuleSet` object, meaning the text must contain special characters. 

```python
rules1.add_rule(IncludeSpecialCharacter())
```

### `NoSpecialChar`

`NoSpecialChar` takes no arguments. It adds the `NoSpecialChar` rule to the specified `RuleSet` object, meaning the text must not contain special characters.

```python
rules1.add_rule(NoSpecialChar())
```

### `RegexPattern`

`RegexPattern` takes one argument: the regex pattern that the text needs to match. It adds the specified `RegexPattern` rule to the specified `RuleSet` object, meaning the text needs to match the specified regex pattern.

```python
rules1.add_rule(RegexPattern(r"^\d+$"))
```

### `StartWith`

`StartWith` takes one argument: the character(s) that the text should start with. It adds the specified `StartWith` rule to the specified `RuleSet` object, meaning the text must start with the specified character(s).

```python
rules1.add_rule(StartWith("A"))
```

### `Endwith`

`EndWith` takes one argument: the character(s) that the text must end with. It adds the specified `EndWith` rule to the specified `RuleSet` object, meaning the text must end with the specified character(s).

```python
rules1.add_rule(EndWith("Z"))
```

### `Contain`

`Contain` takes one argument: the character(s) that the text must contain. It adds the specified `Contain` rule to the specified `RuleSet` object, meaning the text must contain the specified character(s).

```python
rules1.add_rule(Contain("B"))
```

### `Required`

`Required` takes no arguments . It adds the `Required` rule to the specified `RuleSet` object, meaning the text cannot be empty or just spaces.

```python
rules1.add_rule(Required())
```

### `CustomRule`

`CustomRule` takes one argument: a function that takes one argument, the text, and returns a Boolean value. It adds the specified `CustomRule` rule to the specified `RuleSet` object, meaning the function needs to return `True`.

```python
rules1.add_rule(CustomRule(lambda text: text.isupper()))
```

### `validate`

`validate` takes one argument: the text it needs to validate against the rules provided. It checks the text provided against the rules of the specified `RuleSet` object. It returns a Boolean value.

```python
if rules1.validate("hello"):
    print("Yes!")
else:
    print("No!")
```

### `return_error_log`

`return_error_log` takes no arguments. It returns the reason(s) why the text did not meet the criteria.

```python
errors = return_error_log()
```
