Class: ReeDatetime::FindTimeZonesByOffset

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

Instance Method Summary collapse

Instance Method Details

#call(offset) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/find_time_zones_by_offset.rb', line 17

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

  zones = TZInfo::Timezone
    .all_identifiers
    .select { |zone| 
       zone_offset = offset_to_string(find_tzinfo(zone).utc_offset)
       zone_offset == offset 
    }

  CACHE[offset] = zones
  zones
end