Module: Utils

Included in:
Neetob::CLI::Base, Neetob::CLI::Github::Base
Defined in:
lib/neetob/utils.rb

Instance Method Summary collapse

Instance Method Details

#camel_case_to_slug(str) ⇒ Object



8
9
10
11
# File 'lib/neetob/utils.rb', line 8

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

#is_upper?(str) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/neetob/utils.rb', line 13

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

#symbolize_keys(hash) ⇒ Object



4
5
6
# File 'lib/neetob/utils.rb', line 4

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