Module: Asciidoctor::Katex::Utils

Included in:
OpalKatexAdapter, RubyKatexAdapter
Defined in:
lib/asciidoctor/katex/utils.rb

Class Method Summary collapse

Class Method Details

.hash_camelize(hash) ⇒ Hash

Returns a copy of the hash with under_score keys transformed to camelCase.

Parameters:

  • hash (Hash)

    the hash to transform.

Returns:

  • (Hash)

    a copy of the hash with under_score keys transformed to camelCase.


11
12
13
14
15
16
# File 'lib/asciidoctor/katex/utils.rb', line 11

def hash_camelize(hash)
  hash.map { |key, val|
    key = key.to_s.gsub(/_\w/) { |s| s[1].upcase }.to_sym
    [key, val]
  }.to_h
end