Sha256: 5eb97cdeee6bf1754dd46d61d88333a199ac62cfac5a4ac5d6f7261cd7f1ea1d
Contents?: true
Size: 795 Bytes
Versions: 11
Compression:
Stored size: 795 Bytes
Contents
module TensorStream # helper string methods usually found in ActiveSupport but # need to replicate here module StringHelper def camelize(string, uppercase_first_letter = true) string = if uppercase_first_letter string.sub(/^[a-z\d]*/) { $&.capitalize } else string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { $&.downcase } end string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::') end def underscore(string) string.gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr("-", "_").downcase end def symbolize_keys(hash) hash.map do |k, v| [k.to_sym, v] end.to_h end end end
Version data entries
11 entries across 11 versions & 1 rubygems