Class: ReeDatetime::FindHumanTimeZonesByOffset

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/find_human_time_zones_by_offset.rb

Constant Summary collapse

ALL_ZONES =
Set.new(ZONE_HUMAN_NAMES.values)
INVERTED_ZONES =
ZONE_HUMAN_NAMES.invert

Instance Method Summary collapse

Instance Method Details

#call(offset) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/find_human_time_zones_by_offset.rb', line 21

def call(offset)
  return CACHE[offset] if CACHE.has_key?(offset)

  human_zones = find_time_zones_by_offset(offset)
    .select { ALL_ZONES.include?(_1) }
    .map { INVERTED_ZONES[_1] }

  CACHE[offset] = human_zones
  human_zones
end