Class: VORuby::SpaceTime::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/spacetime/spacetime.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spatial, temporal) ⇒ Event

Create a space-time even with the given spatial and temporal parts.



28
29
30
31
32
33
34
# File 'lib/voruby/spacetime/spacetime.rb', line 28

def initialize(spatial, temporal)
  raise Exception::NotASpatialPosition.new(spatial) if !spatial.is_a?(SpatialPosition)
  raise Exception::NotATemporalPosition.new(temporal) if !temporal.is_a?(TemporalPosition)

  self.spatial_position = spatial
  self.temporal_position = temporal
end

Instance Attribute Details

#spatial_positionObject

Returns the value of attribute spatial_position.



25
26
27
# File 'lib/voruby/spacetime/spacetime.rb', line 25

def spatial_position
  @spatial_position
end

#temporal_positionObject

Returns the value of attribute temporal_position.



25
26
27
# File 'lib/voruby/spacetime/spacetime.rb', line 25

def temporal_position
  @temporal_position
end

Instance Method Details

#to_sObject



36
37
38
# File 'lib/voruby/spacetime/spacetime.rb', line 36

def to_s
  "#{self.spatial_position}, #{self.temporal_position}"
end