Sha256: c0c2b9b7d78da396a847b29236b9a689b00ad2cc7f9217d0cf22fcfcf4ec72ad
Contents?: true
Size: 648 Bytes
Versions: 3
Compression:
Stored size: 648 Bytes
Contents
# frozen_string_literal: true module Exclaim module Utilities 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-exclaim-0.1.1 | lib/exclaim/utilities.rb |
ruby-exclaim-0.1.0 | lib/exclaim/utilities.rb |
ruby-exclaim-0.0.0 | lib/exclaim/utilities.rb |