Module: Ruflet::CupertinoIcons
- Defined in:
- lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb
Constant Summary collapse
- ICONS =
begin source = Ruflet::CupertinoIconLookup.icon_map if source.empty? { HOME: "house", SEARCH: "search", SETTINGS: "gear", ADD: "add", CLOSE: "clear" } else source.keys.each_with_object({}) do |name, result| text = name.to_s.gsub(/[^a-zA-Z0-9]/, "_").gsub(/_+/, "_").sub(/\A_/, "").sub(/_\z/, "") text = "ICON_#{text}" if text.match?(/\A\d/) result[text.upcase.to_sym] = name end end.freeze end
Class Method Summary collapse
- .[](name) ⇒ Object
- .all ⇒ Object
- .constants(_inherit = true) ⇒ Object
- .names ⇒ Object
- .random ⇒ Object
Class Method Details
.[](name) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb', line 35 def [](name) key = name.to_s.upcase.to_sym return const_get(key) if const_defined?(key, false) Ruflet::CupertinoIconLookup.canonical_name_for(name) || name.to_s end |
.all ⇒ Object
46 47 48 |
# File 'lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb', line 46 def all ICONS.keys.map { |k| const_get(k) } end |
.constants(_inherit = true) ⇒ Object
42 43 44 |
# File 'lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb', line 42 def constants(_inherit = true) ICONS.keys end |
.names ⇒ Object
54 55 56 |
# File 'lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb', line 54 def names ICONS.values end |
.random ⇒ Object
50 51 52 |
# File 'lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb', line 50 def random all.sample || "question_circle" end |