5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/exclaim/utilities.rb', line 5
def element_name(config_hash)
unless config_hash.is_a?(Hash)
error_message = "Exclaim.element_name can only determine name from a Hash, given #{config_hash.class} value"
Exclaim.logger.warn(error_message)
return
end
return config_hash['$component'] if config_hash.include?('$component')
return config_hash['$helper'] if config_hash.include?('$helper')
return 'bind' if config_hash.include?('$bind')
shorthand_name = config_hash.keys.find { |key| key.start_with?('$') }
shorthand_name&.[](1..)
end
|