Sha256: 55be104108eeecbff7ebf82b6de942c2172fe6a66301bf18d0e05bbaa8e94d97

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Mixins
    # Adds video quality helper methods
    # Assumes a `video_quality` attribute is present of type `Types::VideoQuality`
    module VideoQuality
      def humanized_video_quality
        if video_quality_adaptive?
          I18n.t("adaptive", scope: "dji_mqtt_connect.video_quality")
        elsif video_quality_smooth?
          I18n.t("smooth", scope: "dji_mqtt_connect.video_quality")
        elsif video_quality_standard_definition?
          I18n.t("standard_definition", scope: "dji_mqtt_connect.video_quality")
        elsif video_quality_high_definition?
          I18n.t("high_definition", scope: "dji_mqtt_connect.video_quality")
        elsif video_quality_ultra_high_definition?
          I18n.t("ultra_high_definition", scope: "dji_mqtt_connect.video_quality")
        end
      end

      def video_quality_adaptive?
        video_quality == Types::VIDEO_QUALITY_ADAPTIVE
      end

      def video_quality_smooth?
        video_quality == Types::VIDEO_QUALITY_SMOOTH
      end

      def video_quality_standard_definition?
        video_quality == Types::VIDEO_QUALITY_STANDARD_DEFINITION
      end

      def video_quality_high_definition?
        video_quality == Types::VIDEO_QUALITY_HIGH_DEFINITION
      end

      def video_quality_ultra_high_definition?
        video_quality == Types::VIDEO_QUALITY_ULTRA_HIGH_DEFINITION
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.25.1 lib/dji_mqtt_connect/mixins/video_quality.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/mixins/video_quality.rb