Class: SpaceshipMissionSimulator::Path

Inherits:
Struct
  • Object
show all
Defined in:
lib/spaceship_mission_simulator/path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#eventsObject

Returns the value of attribute events

Returns:

  • (Object)

    the current value of events



2
3
4
# File 'lib/spaceship_mission_simulator/path.rb', line 2

def events
  @events
end

#raw_dataObject

Returns the value of attribute raw_data

Returns:

  • (Object)

    the current value of raw_data



2
3
4
# File 'lib/spaceship_mission_simulator/path.rb', line 2

def raw_data
  @raw_data
end

Instance Method Details

#finish_event?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/spaceship_mission_simulator/path.rb', line 7

def finish_event?
  events.size == 1
end

#fresh_event_consistent?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/spaceship_mission_simulator/path.rb', line 3

def fresh_event_consistent?
  finish_event? || events[0].state != events[1].state
end


15
16
17
# File 'lib/spaceship_mission_simulator/path.rb', line 15

def print
  events.map { |event| "#{event.state} #{event.planet.name}" }.join ', '
end

#start_event?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/spaceship_mission_simulator/path.rb', line 11

def start_event?
  events.size == raw_data.size
end