Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Vmdb::Settings::Validator] Add .integer_with_method?
This tests that a value in the settings is in fact a integer, or a integer that can be evaluated via `.to_i_with_method` to something you would expect. This becomes challenging because `.to_i` by default will take any string and convert it to zero. This means that: irb> "".to_i == 0 true irb> "Five".to_i == 0 true irb> "Foobar".to_i == 0 true Hence the complexity of the method, since it requires checking that: - it is something that is a reasonable to expect for an int - zero when explicitly asked for - a blank value
- Loading branch information