Module: TemporalObject

Defined in:
lib/temporal_object.rb,
lib/temporal_object/version.rb

Overview

Author:

Constant Summary

VERSION =
"0.1.5"

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) temporal_statuses

Array

of TimeSpan::TimeLine statuses for temporal attributes



9
10
11
# File 'lib/temporal_object.rb', line 9

def temporal_statuses
  @temporal_statuses
end

Instance Method Details

- (Array) add_timeline(timeline)

add a timeline to the TemporalObject

Parameters:

  • timeline (TimeSpan::TimeLine)

    added to the object

Returns:

  • (Array)

    adjusted list of timelines if no exception raised.

Raises:

  • (ArgumentError)


19
20
21
22
# File 'lib/temporal_object.rb', line 19

def add_timeline(timeline)
  raise ArgumentError, "Can only add a TimeSpan::TimeLine to a TemporalObject's statuses" unless timeline.kind_of? TimeSpan::TimeLine
  @temporal_statuses << timeline
end

- (TemporalObject) initialize

A new instance of TemporalObject



11
12
13
14
# File 'lib/temporal_object.rb', line 11

def initialize
  super
  @temporal_statuses = []         # Array of TimeSpan::TimeLine
end

- (TimeSpan::TimeLine?) remove_timeline(timeline)

delete the cited timeline

Parameters:

  • timeline (TimeSpan::TimeLine)

    timeline to delete

Returns:

  • (TimeSpan::TimeLine, nil)

    TimeLIne deleted if successful or nil if not

Raises:

  • ArgumentError if called with a non-TimeLine object



34
35
36
37
# File 'lib/temporal_object.rb', line 34

def remove_timeline(timeline)
  raise ArgumentError, "Can only remove a TimeLine with this call."  unless timeline.kind_of? TimeSpan::TimeLine
  @temporal_statuses.delete(timeline)
end

- (Array) remove_timelines

remove all TimeLine s from the TemporalObject

Returns:

  • (Array)

    the associated timelines



26
27
28
# File 'lib/temporal_object.rb', line 26

def remove_timelines
  @temporal_statuses = []
end