Module: TanukiEmoji

Defined in:
lib/tanuki_emoji.rb,
lib/tanuki_emoji/db.rb,
lib/tanuki_emoji/index.rb,
lib/tanuki_emoji/errors.rb,
lib/tanuki_emoji/version.rb,
lib/tanuki_emoji/character.rb,
lib/tanuki_emoji/db/gemojione.rb,
lib/tanuki_emoji/db/emoji_data.rb,
lib/tanuki_emoji/db/unicode_ordering.rb,
lib/tanuki_emoji/db/emoji_data_parser.rb,
lib/tanuki_emoji/db/emoji_test_parser.rb,
lib/tanuki_emoji/db/additional_aliases.rb

Overview

Tanuki Emoji

Defined Under Namespace

Modules: Db Classes: AlphaCodeAlreadyIndexedError, Character, CodepointAlreadyIndexedError, Index

Constant Summary collapse

Error =
Class.new(StandardError)
VERSION =
'0.13.0'

Class Method Summary collapse

Class Method Details

.add(name, codepoints:, alpha_code:, description:, category:) ⇒ TanukiEmoji::Character

Add a new Emoji to the index

Parameters:

  • name (String)
  • codepoints (String)
  • alpha_code (String)
  • description (String)
  • category (String)

Returns:



44
45
46
47
48
49
50
51
52
# File 'lib/tanuki_emoji.rb', line 44

def self.add(name, codepoints:, alpha_code:, description:, category:)
  emoji = Character.new(name,
    codepoints: codepoints,
    alpha_code: alpha_code,
    description: description,
    category: category)

  index.add(emoji)
end

.find_by_alpha_code(alpha_code) ⇒ TanukiEmoji::Character

Find an Emoji by its :alpha_code:

Parameters:

  • alpha_code (String)

Returns:



17
18
19
# File 'lib/tanuki_emoji.rb', line 17

def self.find_by_alpha_code(alpha_code)
  index.find_by_alpha_code(alpha_code)
end

.find_by_codepoints(unicode_codepoints) ⇒ TanukiEmoji::Character

Find an Emoji by its Unicode representation

Parameters:

  • unicode_codepoints (String)

Returns:



25
26
27
# File 'lib/tanuki_emoji.rb', line 25

def self.find_by_codepoints(unicode_codepoints)
  index.find_by_codepoints(unicode_codepoints)
end

.images_pathObject



54
55
56
# File 'lib/tanuki_emoji.rb', line 54

def self.images_path
  File.expand_path(File.join(__dir__, "../app/assets/images/tanuki_emoji"))
end

.indexArray<TanukiEmoji::Character>

Index contains all known emojis

Returns:



32
33
34
# File 'lib/tanuki_emoji.rb', line 32

def self.index
  TanukiEmoji::Index.instance
end