-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SimpleElementVals behave more consistently across types (AN, DT,…
… ID, Nn, R, TM) - Invalid#map and Invalid#copy always return Invalid - Invaild#== is now #eql?, so it will not == nil any longer - Empty#map and Empty#copy always call the type's .value constructor; previously sometimes it only constructed another Empty - Empty#== is true for "" on AN and ID, and nil on DT, Nn, R, TM - Empty#value is now implemented and returns "" for AN and ID, and nil for DT, Nn, R, and TM - Empty#map now yields #value, which is either nil or "" - All non-Invalid values implement #coerce - Each type now has a case in .value for when the argument is already the correct type (similar to a copy constructor), this is used in #coerce - Each type also has a case in .value for the data in #value of the corresponding type, so eg. DateVal.value(date_val.value) == date_val - DateVal::Improper#value is now [year, month, day], and now #map yields this single argument (a three-element array) instead of three arguments - TimeVal::Valid#value is now [hour, minute, second], and now #map yields this single argument instead of three arguments - Greatly reduce duplication of specs for each element type by using shared_examples for invalid, empty, and non-empty cases
- Loading branch information
Showing
15 changed files
with
848 additions
and
1,865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.