Class: ShopifyCLI::ResolveConstant

Inherits:
Object
  • Object
show all
Includes:
MethodObject
Defined in:
lib/shopify_cli/resolve_constant.rb

Instance Method Summary collapse

Methods included from MethodObject

included, #to_proc

Instance Method Details

#call(name) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/shopify_cli/resolve_constant.rb', line 16

def call(name)
  name
    .to_s
    .split(%r{/|:{2}})
    .map { |const_name| const_name.split(/[_-]/).map(&:capitalize).join("") }
    .join("::")
    .yield_self { |const_name| namespace.const_get(const_name) }
end