Sha256: b4a53272dcc891973ff389e3f5a346478552971b62edba4f3e198be039d3ab6a

Contents?: true

Size: 1.11 KB

Versions: 31

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

# :reek:FeatureEnvy
# :reek:UtilityFunction

module RubyRabbitmqJanus
  module Tools
    # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>

    # # Utility for manage option to this gem.
    #
    # This class start all singleton, Log, Config, Request and Keepalive
    # instance. It's also used for testing session/handle used in request.
    class Option
      def initialize
        Config.instance
        Requests.instance
      end

      # Determine session_id used
      #
      # @param [Hash] options Read options used in request
      #
      # @return [Fixnum] Session ID
      #
      # @since 2.0.0
      def use_current_session?(options)
        if options.key?('session_id')
          options['session_id']
        else
          Models::JanusInstance.first.session
        end
      end

      # Determine handle_id used
      #
      # @param [Hash] options Read options used in request
      #
      # @return [Fixnum] Handle ID
      #
      # @since 2.0.0
      def use_current_handle?(options)
        options.key?('handle_id') ? options['handle_id'] : 0
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-4.0.1 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.1.pre.1265973744 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.1.pre.1265506307 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.1.pre.1265140558 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.1001345090 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.1001181479 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.1001132533 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.1001107243 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.1001043172 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.949167646 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.946892338 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.946565704 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.939149205 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.939137013 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.939133437 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.939119110 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.939113634 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-4.0.0.pre.850041590 lib/rrj/tools/gem/option.rb
ruby_rabbitmq_janus-3.0.1 lib/rrj/tools/gem/option.rb