Project

time_span

0.0
No commit activity in last 3 years
No release in over 3 years
Time spans, including many comparators. Abstract time ONLY.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Time Span

This gem is composed of 3 classes:

  • RelativeTime, which are time objects, with a link to another other Ruby Object. They are not in any way absolute,1and relate only to other RelativeTime objects on the same TimeLine. Many RelativeTimes can happen at the same time. It is not possible to get a difference, as it would be meaningless. Other comparators are implemented.
  • TimeLine, is the context for RelativeTimes and TimeSpans for comparison.
  • TimeSpan, which is composed of two RelativeTimes (a begining and ending time) on a TimeLine.

A RelativeTime has an associate Ruby Object (of any class), which should '#respond_to?(:to_s)'

A RelativeTime can occur with more than one TimeSpan, so must also keep track of the TimeLine to TimeSpan relationship.

Comparisons of any kind only make sense within a given TimeLine.

TimeSpans are automatically attached to a TimeLine, but RelativeTimes are not.

TimeLines are the only structure with even a moderate data complexity. There is is a hash which keeps the relative position for each RelativeTime. This structure allows more than one RelativeTime to be equal compared to other RelativeTimes.

For now, clone is disallowed, it could create an object not obeying the rules, such as a RelativeTime pointing to TimeLine not its own.

If you would rather use standard Earth time, you might look into the runt gem.

endorse