Class: Unisec::Versions

Inherits:
Object
  • Object
show all
Defined in:
lib/unisec/versions.rb

Overview

Version information related to Unicode used in Unisec

Class Method Summary collapse

Class Method Details

.displayObject

Display a CLI-friendly output of the version of anything related to Unicode used in unisec

Examples:

Unisec::Versions.display
# =>
# Unicode:
# Unicode (Ruby)                    15.0.0
# …
#
# Gems:
# unisec                            0.0.1
# …


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/unisec/versions.rb', line 73

def self.display # rubocop:disable Metrics/AbcSize
  data = versions
  colorize = ->(node) { Paint[data[node][:label], :red, :bold].ljust(44) + " #{data[node][:version]}\n" }
  Paint["Unicode:\n", :underline] +
    colorize.call(:ruby_unicode) +
    colorize.call(:twittercldr_unicode) +
    colorize.call(:unicodeconfusable_unicode) +
    colorize.call(:twittercldr_icu) +
    colorize.call(:twittercldr_cldr) +
    colorize.call(:ruby_unicode_emoji) +
    colorize.call(:ucd_derivedname) +
    Paint["\nGems:\n", :underline] +
    colorize.call(:unisec) +
    colorize.call(:twittercldr) +
    colorize.call(:unicodeconfusable)
end

.versionsHash

Version and label of anything related to Unicode used in Unisec

Examples:

Unisec::Versions.versions
# =>
# {:unisec=>{:version=>"0.0.1", :label=>"unisec"},
#  … }

Returns:

  • (Hash)

    versions of each component



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/unisec/versions.rb', line 17

def self.versions # rubocop:disable Metrics/MethodLength
  {
    unisec: {
      version: Unisec::VERSION,
      label: 'unisec'
    },
    ruby_unicode: {
      version: RbConfig::CONFIG['UNICODE_VERSION'],
      label: 'Unicode (Ruby)'
    },
    ruby_unicode_emoji: {
      version: RbConfig::CONFIG['UNICODE_EMOJI_VERSION'],
      label: 'Unicode emoji (Ruby)'
    },
    twittercldr_cldr: {
      version: TwitterCldr::Versions::CLDR_VERSION,
      label: 'CLDR (twitter_cldr gem)'
    },
    twittercldr_icu: {
      version: TwitterCldr::Versions::ICU_VERSION,
      label: 'ICU (twitter_cldr gem)'
    },
    twittercldr_unicode: {
      version: TwitterCldr::Versions::UNICODE_VERSION,
      label: 'Unicode (twitter_cldr gem)'
    },
    twittercldr: {
      version: TwitterCldr::VERSION,
      label: 'twitter_cldr gem'
    },
    unicodeconfusable: {
      version: Unicode::Confusable::VERSION,
      label: 'unicode-confusable gem'
    },
    unicodeconfusable_unicode: {
      version: Unicode::Confusable::UNICODE_VERSION,
      label: 'Unicode (unicode-confusable gem)'
    },
    ucd_derivedname: {
      version: Unisec::Rugrep.ucd_derivedname_version,
      label: 'UCD (data/DerivedName.txt)'
    }
  }
end