Method: Unicode::Scripts.names
- Defined in:
- lib/unicode/scripts.rb
.names(format: :long, augmented: :exclude) ⇒ Object
Lists scripts. Options:
-
format - :long, :short
-
augmented - :include, :exclude, :only
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/unicode/scripts.rb', line 102 def self.names(format: :long, augmented: :exclude) if format == :long && augmented != :exclude raise ArgumentError, "only short four-letter script codes (ISO 15924) supported when listing augmented scripts" end if augmented == :only return AUGMENTED_SCRIPT_CODES end require_relative 'scripts/index' unless defined? ::Unicode::Scripts::INDEX if format == :long INDEX[:SCRIPT_NAMES].sort elsif augmented == :exclude INDEX[:SCRIPT_ALIASES].keys.sort else (INDEX[:SCRIPT_ALIASES].keys + AUGMENTED_SCRIPT_CODES).sort end end |