Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emaringolo/history
A collection-like object to hold and retrieve elements that are dated
https://github.com/emaringolo/history
pharo smalltalk
Last synced: 16 days ago
JSON representation
A collection-like object to hold and retrieve elements that are dated
- Host: GitHub
- URL: https://github.com/emaringolo/history
- Owner: eMaringolo
- License: mit
- Created: 2015-12-17T04:09:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-03T00:21:37.000Z (about 2 years ago)
- Last Synced: 2024-10-09T13:25:09.462Z (about 1 month ago)
- Topics: pharo, smalltalk
- Language: Smalltalk
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History-Core/AbstractHistory.class.st
- License: LICENSE
Awesome Lists containing this project
README
Introduction
=========This package provides the utility class `History` that can help when dealing with dated objects. It is, objects that have a magnitude like Date, Time, DateAndTime, etc. and can be sorted historically according to this or any other magnitude.
So when you have to query for some element at certain date, the History class will perform the lookup.
But the added value is that the lookup can be for a matching date or if you need to obtain an element that applies for a certain date, it will retrieve the closest to the queried date.E.g. If the History contain aPermit dated 2015-03-01 14:00, and no other aftewards, then `aHistory at: '2015-05-15 00:00' asDateAndTime` will return the one from March.
For most purposes the `History` class can act as a `Collection`, supporting enumeration, adding, removing elements, filtering, etc. (it is `#do:`, `#detect:ifNone:`, etc.)
See the tests for more examples of how to use it.