module Motor::FindIcon
Constants
- DEFAULT_ICON
- ICONS_MAP
Public Instance Methods
call(text)
click to toggle source
# File lib/motor/build_schema/find_icon.rb, line 121 def call(text) text = text.underscore icon = ICONS_MAP[text] || ICONS_MAP[text.singularize] icon ||= text.split(%r{[\s_/]}).reverse.reduce(nil) do |_acc, word| found_icon = ICONS_MAP[word] || ICONS_MAP[word.singularize] break found_icon if found_icon end icon || DEFAULT_ICON end