Class: VORuby::SpaceTime::Event
- Defined in:
- lib/voruby/spacetime/spacetime.rb
Instance Attribute Summary collapse
-
#spatial_position ⇒ Object
Returns the value of attribute spatial_position.
-
#temporal_position ⇒ Object
Returns the value of attribute temporal_position.
Instance Method Summary collapse
-
#initialize(spatial, temporal) ⇒ Event
constructor
Create a space-time even with the given spatial and temporal parts.
- #to_s ⇒ Object
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_position ⇒ Object
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_position ⇒ Object
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_s ⇒ Object
36 37 38 |
# File 'lib/voruby/spacetime/spacetime.rb', line 36 def to_s "#{self.spatial_position}, #{self.temporal_position}" end |