Sha256: 364d852441f0554628f9fe5981de98c813731ea539414222a66ba2dbf907754b

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Mixins
    # Adds video type helper methods
    # Assumes a `video_type` attribute is present of type `Types::VideoType`
    module VideoType
      def humanized_video_type
        if video_type_infrared?
          I18n.t("infrared", scope: "dji_mqtt_connect.video_types") # Infrared
        elsif video_type_normal?
          I18n.t("normal", scope: "dji_mqtt_connect.video_types") # Default
        elsif video_type_wide_angle?
          I18n.t("wide_angle", scope: "dji_mqtt_connect.video_types") # Wide-angle
        elsif video_type_zoom?
          I18n.t("zoom", scope: "dji_mqtt_connect.video_types") # Zoom
        end
      end

      def video_type_infrared?
        video_type == Types::VIDEO_TYPE_INFRARED
      end

      def video_type_normal?
        video_type == Types::VIDEO_TYPE_NORMAL
      end

      def video_type_wide_angle?
        video_type == Types::VIDEO_TYPE_WIDE_ANGLE
      end

      def video_type_zoom?
        video_type == Types::VIDEO_TYPE_ZOOM
      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_type.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/mixins/video_type.rb