Sha256: 384ae416d699f2e25f236012a7b4bf877ebac60c0a302c813e50dae2c931f1a6

Contents?: true

Size: 589 Bytes

Versions: 43

Compression:

Stored size: 589 Bytes

Contents

require "emot/version"
require "emot/map"
require "emot/symbol_ext"
require "emot/cli"

module Emot
  def icon(name)
    build_icon( MAP[name.intern] )
  end
  alias :emoji :icon

  def unicode(name)
    build_unicode( MAP[name.intern] )
  end

  def list
    Hash[
      MAP.map do |name, codes|
        [name, [build_icon(codes), build_unicode(codes)]]
      end.sort_by(&:last)
    ]
  end

  private
  def build_icon(codes)
    codes.pack("U*") if codes
  end

  def build_unicode(codes)
    codes.map { |code| "U+#{code.to_s(16).upcase}" }.join(" ") if codes
  end

  extend self
end

Version data entries

43 entries across 28 versions & 2 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/emot-0.0.4/lib/emot.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/emot-0.0.4/lib/emot.rb