Sha256: 0f0681c1e7d1ad1c1ebe9cf867e58f261a1657b2f99491bcd3cc61510e4eb6c2
Contents?: true
Size: 772 Bytes
Versions: 16
Compression:
Stored size: 772 Bytes
Contents
# frozen_string_literal: true class Serega module SeregaUtils # # Utility to get frozen string from symbol in any ruby version # class SymbolName class << self # # Returns frozen string corresponding to provided symbol # # @param key [Symbol] # # @return [String] frozen string corresponding to provided symbol # def call(key) key.is_a?(String) ? key : to_frozen_string(key) end private # :nocov: if RUBY_VERSION < "3" def to_frozen_string(key) key.to_s.freeze end else def to_frozen_string(key) key.name end end # :nocov: end end end end
Version data entries
16 entries across 16 versions & 1 rubygems