Module: WscSdk::Enums

Included in:
BillingMode, BroadcastLocation, BufferSize, ClosedCaptionType, CustomProvider, DeliveryMethod, DeliveryType, Encoder, IdleTimeout, ImagePosition, PlayerType, Protocol, TargetDeliveryProtocol, TranscoderType, WowzaProvider
Defined in:
lib/wsc_sdk/enums.rb,
lib/wsc_sdk/enums/encoder.rb,
lib/wsc_sdk/enums/protocol.rb,
lib/wsc_sdk/enums/buffer_size.rb,
lib/wsc_sdk/enums/player_type.rb,
lib/wsc_sdk/enums/billing_mode.rb,
lib/wsc_sdk/enums/idle_timeout.rb,
lib/wsc_sdk/enums/delivery_type.rb,
lib/wsc_sdk/enums/image_position.rb,
lib/wsc_sdk/enums/wowza_provider.rb,
lib/wsc_sdk/enums/custom_provider.rb,
lib/wsc_sdk/enums/delivery_method.rb,
lib/wsc_sdk/enums/transcoder_type.rb,
lib/wsc_sdk/enums/broadcast_location.rb,
lib/wsc_sdk/enums/closed_caption_type.rb,
lib/wsc_sdk/enums/target_delivery_protocol.rb

Overview

A module for defining sets of enumerators and their behaviors.

Defined Under Namespace

Modules: BillingMode, BroadcastLocation, BufferSize, ClosedCaptionType, CustomProvider, DeliveryMethod, DeliveryType, Encoder, IdleTimeout, ImagePosition, PlayerType, Protocol, TargetDeliveryProtocol, TranscoderType, WowzaProvider

Instance Method Summary collapse

Instance Method Details

#to_constant(name) ⇒ Object

Convert a string or symbol into the appropriate constant, and generate an exception otherwise.



25
26
27
28
29
# File 'lib/wsc_sdk/enums.rb', line 25

def to_constant(name)
  constant_name = name.to_s.upcase.to_sym
  raise "Model type '#{name.to_s}' doesn't exist" unless self.constants.include?(constant_name)
  return self.const_get("#{self.name}::#{constant_name}")
end

#valuesArray<Any>

Get a list of values from constants defined in the enum.

Returns:

  • (Array<Any>)

    The values defined by the enumerator.



15
16
17
18
19
# File 'lib/wsc_sdk/enums.rb', line 15

def values
  _values = []
  self.constants(false).each { |constant| _values << self.const_get(constant) }
  _values
end