Class: TemporalObject::TemporalObject
- Inherits:
-
Object
- Object
- TemporalObject::TemporalObject
- Defined in:
- lib/temporal_object.rb
Overview
Instance Attribute Summary (collapse)
-
- (Object) name
- String
-
object human readable identifier.
-
- (Object) reference_object
- Object
-
associated Ruby Object of any kind.
-
- (Object) statuses
- Array
-
of TimeSpan::TimeLine statuses for temporal attributes.
Instance Method Summary (collapse)
-
- (Array) add_timeline(timeline)
add a timeline to the TemporalObject.
-
- (TemporalObject) initialize(nom = "", reference_obj = Object.new)
constructor
A new instance of TemporalObject.
-
- (TimeSpan::TimeLine?) remove_timeline(timeline)
delete the cited timeline.
-
- (Array) remove_timelines
remove all TimeLine s from the TemporalObject.
Constructor Details
- (TemporalObject) initialize(nom = "", reference_obj = Object.new)
A new instance of TemporalObject
26 27 28 29 30 |
# File 'lib/temporal_object.rb', line 26 def initialize(nom="", reference_obj=Object.new) @statuses = [] # Array of TimeSpan::TimeLine @name = "" @reference_object = reference_obj end |
Instance Attribute Details
- (Object) name
- String
-
object human readable identifier
13 14 15 |
# File 'lib/temporal_object.rb', line 13 def name @name end |
- (Object) reference_object
- Object
-
associated Ruby Object of any kind
15 16 17 |
# File 'lib/temporal_object.rb', line 15 def reference_object @reference_object end |
- (Object) statuses
- Array
-
of TimeSpan::TimeLine statuses for temporal attributes
11 12 13 |
# File 'lib/temporal_object.rb', line 11 def statuses @statuses end |
Instance Method Details
- (Array) add_timeline(timeline)
add a timeline to the TemporalObject
35 36 37 38 |
# File 'lib/temporal_object.rb', line 35 def add_timeline(timeline) raise ArgumentError, "Can only add a TimeSpan::TimeLine to a TemporalObject's statuses" unless timeline.kind_of? TimeSpan::TimeLine @statuses << timeline end |
- (TimeSpan::TimeLine?) remove_timeline(timeline)
delete the cited timeline
50 51 52 53 |
# File 'lib/temporal_object.rb', line 50 def remove_timeline(timeline) raise ArgumentError, "Can only remove a TimeLine with this call." unless timeline.kind_of? TimeSpan::TimeLine @statuses.delete(timeline) end |
- (Array) remove_timelines
remove all TimeLine s from the TemporalObject
42 43 44 |
# File 'lib/temporal_object.rb', line 42 def remove_timelines @statuses = [] end |