Acts as placed on timeline

Ruby forge project | Acts as placed on timeline | DateTimeRange object API

Class methods

new(args)
Creates a new ActiveRecord object. Use the :at options to create objects on a specific range. The default range is DateTimeRange.whenever.

find(args)
The default behavior of this function is to find all the objects that are valid on DateTimeRange.now You can override this behavior by using the :at option.

:at a DateTimeRange is parsed from this option that defines the validity search period.

find_whenever(args)
This is a shortcut method. This method is equal to find(args, :at => DateTimeRange.whenever).

count(args), sum(args), maximum(args), minimum(args)
These default methods have been replaced by new ones that only use the objects that are valid on DateTimeRange.now. You can override the search range by using the :at option.

count_whenever(args)
This is a shortcut method. This method is equal to count(args, :at => DateTimeRange.whenever).

destroy(ids, options)
Destroy the specific ids on DateTimeRange. The default range is DateTimeRange.future. This may result in exceptions if the ids listed have the same timeline_id, as those might have been removed.

destroy_all(conditions, options)
Destroy the objects on DateTimeRange that match the given conditions. The default range is DateTimeRange.future.

Instance methods

at=(DateTimeRange)
Use this override method to set the :at range for the next operation. After that operation the :at range is automatically cleared.

update_attributes(attributes, options), update_attribute(attribute, options)
These methods support the :at option. By default the range is DateTimeRange.future.

save(options)
This method used to have a boolean to determine whether validation would be active. AAPOT objects support the :at option too. So Address.save(false, :at => DateTimeRange.whenever) works as expected. By default the range is DateTimeRange.future.

destroy(options)
This method destroys the object on a specific range. If the range is :inside the current range, a gap is created. Specify the range using the :at option. By default the range is DateTimeRange.future.

timeline(options)
This method returns a specific part of the objects based on their timeline location relative to the object it is called on. The method accepts two options.

:only part of the timeline that is returned
:window a DateTimeRange to limit the returned part

The :only options has several values.

:previous Only the previous object on the timeline is returned
:next Only the next object on the timeline is returned
:predecessors Only the previous objects on the timeline are returned
:successors Only the next objects on the timeline are returned