Sha256: a1abd43f95506a31dc4e1ac99e90fcee977e4a9568962587198c2962b0f3f9d7

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module DjiMqttConnect
end
# frozen_string_literal: true

module DjiMqttConnect
  module Mixins
    # Provides checks for the output object that contains a Types::ServicesOutputStatus status value
    module ServicesOutputStatusChecks
      def status_finalized?
        [
          Types::SERVICE_OUTPUT_STATUS_OK,
          Types::SERVICE_OUTPUT_STATUS_REJECTED,
          Types::SERVICE_OUTPUT_STATUS_FAILED,
          Types::SERVICE_OUTPUT_STATUS_CANCELED,
          Types::SERVICE_OUTPUT_STATUS_TIMEOUT
        ].include?(status)
      end
      alias_method :status_finalised?, :status_finalized?

      def humanized_status
        I18n.t(status, scope: "dji_mqtt_connect.services_output_status", default: status.titleize)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.14.1 lib/dji_mqtt_connect/mixins/services_output_status_checks.rb
dji_mqtt_connect-0.1.14 lib/dji_mqtt_connect/mixins/services_output_status_checks.rb