Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce minimum, maximum and numeric types #25

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

mechnicov
Copy link
Contributor

Introduce minimum, maximum and numeric types

README.md Outdated
@@ -500,6 +503,12 @@ Returns ValidResult if and only if provided value is an integer. Doesn't transfo

I18n keys: `error_key`, `'.integer'`, `'datacaster.errors.integer'`.

#### `numeric(error_key = nil)`

Returns ValidResult if and only if provided value is a number. Doesn't transform the value.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"provided value is a number (Ruby's Numeric)"

README.md Outdated
@@ -523,6 +532,26 @@ I18n keys:
* not an integer – `error_key`, `'.integer'`, `'datacaster.errors.integer'`
* too big – `error_key`, `'.integer32'`, `'datacaster.errors.integer32'`

#### `maximum(max, error_key = nil, inclusive: true)`

Returns ValidResult if and only if provided value is a number and is less than specified. Doesn't transform the value.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns ValidResult if and only if provided value is a number and is less than `max`. If `inclusive` set to true, provided value should be less than or equal to `max`.

README.md Outdated

#### `minimum(min, error_key = nil, inclusive: true)`

Returns ValidResult if and only if provided value is a number and is greater than specified. Doesn't transform the value.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns ValidResult if and only if provided value is a number and is greater than `min`. If `inclusive` set to true, provided value should be greater than or equal to `min`.
``

@@ -1,3 +1,3 @@
module Datacaster
VERSION = "4.1.0"
VERSION = "4.1.1"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.2.0

@EugZol EugZol merged commit e7c604b into EugZol:master Feb 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants