Sha256: d2dcdfb394a01a802c1eb731679036577593339b5debc3902166695ca45edb34

Contents?: true

Size: 373 Bytes

Versions: 2

Compression:

Stored size: 373 Bytes

Contents

module SpaceshipMissionSimulator
  class ValidateEventData
    include Interactor

    def call
      return true if correct_event_data?

      msg = 'should provide proper event format ([state, gravity])'
      context.fail! message: msg
    end

    private

    def correct_event_data?
      context.raw_data.is_a?(Array) && context.raw_data.size == 2
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spaceship_mission_simulator-0.2.0 lib/spaceship_mission_simulator/interactors/validate_event_data.rb
spaceship_mission_simulator-0.1.0 lib/spaceship_mission_simulator/interactors/validate_event_data.rb