Sha256: e1fc9b848619106d2f46ca67c451a14ec0a68d3f28d3abc19a60064ceefba8bb

Contents?: true

Size: 331 Bytes

Versions: 84

Compression:

Stored size: 331 Bytes

Contents

# frozen_string_literal: true

module Utils
  def symbolize_keys(hash)
    hash.transform_keys(&:to_sym)
  end

  def camel_case_to_slug(str)
    str.split("").map.with_index { |ch, idx|
 is_upper?(ch) && !is_upper?(str[idx - 1]) ? "-#{ch.downcase}" : ch.downcase }.join
  end

  def is_upper?(str)
    str == str.upcase
  end
end

Version data entries

84 entries across 84 versions & 2 rubygems

Version Path
neetob-0.5.16 lib/neetob/utils.rb
neetob-0.5.15 lib/neetob/utils.rb
neetob-0.5.14 lib/neetob/utils.rb
neetob-0.5.13 lib/neetob/utils.rb
neetob-0.5.12 lib/neetob/utils.rb
neetob-0.5.11 lib/neetob/utils.rb
neetob-0.5.10 lib/neetob/utils.rb
neetob-0.5.9 lib/neetob/utils.rb
neetob-0.5.8 lib/neetob/utils.rb
neetob-0.5.7 lib/neetob/utils.rb
neetob-0.5.6 lib/neetob/utils.rb
neetob-0.5.5 lib/neetob/utils.rb
neetob-0.5.4 lib/neetob/utils.rb
neetob-0.5.3 lib/neetob/utils.rb
neetob-0.5.2 lib/neetob/utils.rb
neetob-0.5.1 lib/neetob/utils.rb
neetob-0.5.0 lib/neetob/utils.rb
neetob-0.4.37 lib/neetob/utils.rb
neetob-0.4.36 lib/neetob/utils.rb
neetob-0.4.35 lib/neetob/utils.rb