Class: ConfigCat::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/configcat/utils.rb

Constant Summary collapse

DISTANT_FUTURE =
Float::INFINITY
DISTANT_PAST =
0

Class Method Summary collapse

Class Method Details

.get_date_time(seconds_since_epoch) ⇒ Object



6
7
8
# File 'lib/configcat/utils.rb', line 6

def self.get_date_time(seconds_since_epoch)
  Time.at(seconds_since_epoch).utc
end

.get_seconds_since_epoch(date_time) ⇒ Object



14
15
16
# File 'lib/configcat/utils.rb', line 14

def self.get_seconds_since_epoch(date_time)
  date_time.to_time.to_f
end

.get_utc_now_seconds_since_epochObject



10
11
12
# File 'lib/configcat/utils.rb', line 10

def self.get_utc_now_seconds_since_epoch
  Time.now.utc.to_f
end

.is_string_list(value) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/configcat/utils.rb', line 18

def self.is_string_list(value)
  # Check if the value is an Array
  return false unless value.is_a?(Array)

  # Check if all elements in the Array are Strings
  value.each do |item|
    return false unless item.is_a?(String)
  end

  return true
end