Sha256: 0267d2a2ec3b8de78602a1c5e2529289077d5216e17f38da7f7b68d1ee204ee7

Contents?: true

Size: 623 Bytes

Versions: 23

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Mixins
    # Provides checks for the event progress object that contains a Types::EventsProgressStepKey step_key value
    module EventsProgressChecks
      # Provide accessors for each step key value
      DjiMqttConnect::Types::EventsProgressStepKey.values.each do |step_key_value|
        define_method(:"#{step_key_value}_step?") { step_key == step_key_value }
      end

      def humanized_step_key
        return unless step_key

        I18n.t(step_key, scope: "dji_mqtt_connect.events_step_key", default: step_key.titleize)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.16.2 lib/dji_mqtt_connect/mixins/events_progress_checks.rb
dji_mqtt_connect-0.1.16.1 lib/dji_mqtt_connect/mixins/events_progress_checks.rb
dji_mqtt_connect-0.1.16 lib/dji_mqtt_connect/mixins/events_progress_checks.rb