module Somemoji

Constants

VERSION

Public Class Methods

apple_emoji_collection() click to toggle source

@return [Somemoji::EmojiCollection] an emoji collection including Apple emojis @example

Somemoji.apple_emoji_collection.count #=> 1285
# File lib/somemoji.rb, line 23
def apple_emoji_collection
  @apple_emoji_collection ||= ::Somemoji::EmojiCollection.new(apple_emojis)
end
apple_supported_characters_path() click to toggle source

@return [String]

# File lib/somemoji.rb, line 28
def apple_supported_characters_path
  ::File.expand_path("../../data/apple_supported_characters.json", __FILE__)
end
emoji_collection() click to toggle source

@return [Somemoji::EmojiCollection] an emoji collection including all emojis @example

Somemoji.emoji_collection.class #=> Somemoji::EmojiCollection
Somemoji.emoji_collection.count #=> 1794
Somemoji.emoji_collection.first.class #=> Somemoji::Emoji
# File lib/somemoji.rb, line 37
def emoji_collection
  @emoji_collection ||= ::Somemoji::EmojiCollection.new(emojis)
end
emoji_definitions_directory_path() click to toggle source

@return [String]

# File lib/somemoji.rb, line 49
def emoji_definitions_directory_path
  ::File.expand_path("../../data/emoji_definitions", __FILE__)
end
emoji_one_emoji_collection() click to toggle source

@return [Somemoji::EmojiCollection] an emoji collection including EmojiOne emojis @example

Somemoji.emoji_one_emoji_collection.count #=> 1794
# File lib/somemoji.rb, line 44
def emoji_one_emoji_collection
  emoji_collection
end
noto_emoji_collection() click to toggle source

@return [Somemoji::EmojiCollection] an emoji collection including Noto emojis @example

Somemoji.noto_emoji_collection.count #=> 1541
# File lib/somemoji.rb, line 56
def noto_emoji_collection
  @noto_emoji_collection ||= ::Somemoji::EmojiCollection.new(noto_emojis)
end
noto_supported_characters_path() click to toggle source

@return [String]

# File lib/somemoji.rb, line 61
def noto_supported_characters_path
  ::File.expand_path("../../data/noto_supported_characters.json", __FILE__)
end
twemoji_emoji_collection() click to toggle source

@return [Somemoji::EmojiCollection] an emoji collection including Twemoji emojis @example

Somemoji.twemoji_emoji_collection.count #=> 1626
# File lib/somemoji.rb, line 68
def twemoji_emoji_collection
  @twemoji_emoji_collection ||= ::Somemoji::EmojiCollection.new(twemoji_emojis)
end
twemoji_supported_characters_path() click to toggle source

@return [String]

# File lib/somemoji.rb, line 73
def twemoji_supported_characters_path
  ::File.expand_path("../../data/twemoji_supported_characters.json", __FILE__)
end

Private Class Methods

apple_emojis() click to toggle source

@return [Array<Twemoji::Emoji>]

# File lib/somemoji.rb, line 80
def apple_emojis
  apple_supported_characters.map do |character|
    emoji_collection.find_by_character(character)
  end.compact
end
apple_supported_characters() click to toggle source

@return [Array<String>]

# File lib/somemoji.rb, line 87
def apple_supported_characters
  ::JSON.parse(::File.read(apple_supported_characters_path))
end
emoji_definition_paths() click to toggle source

@return [Array<String>]

# File lib/somemoji.rb, line 92
def emoji_definition_paths
  ::Dir.glob("#{emoji_definitions_directory_path}/*.json").sort
end
emoji_definitions() click to toggle source

@return [Array<Hash>]

# File lib/somemoji.rb, line 97
def emoji_definitions
  emoji_definition_paths.map do |emoji_definition_path|
    ::JSON.parse(::File.read(emoji_definition_path))
  end
end
emojis() click to toggle source

@return [Array<Somemoji::Emoji>]

# File lib/somemoji.rb, line 104
def emojis
  emoji_definitions.map do |hash|
    ::Somemoji::Emoji.new(
      aliases: hash["aliases"],
      ascii_arts: hash["ascii_arts"],
      category: hash["category"],
      code_points: hash["code_points"],
      code: hash["code"],
      keywords: hash["keywords"],
      name: hash["name"],
    )
  end
end
noto_emojis() click to toggle source

@return [Array<Twemoji::Emoji>]

# File lib/somemoji.rb, line 119
def noto_emojis
  noto_supported_characters.map do |character|
    emoji_collection.find_by_character(character)
  end.compact
end
noto_supported_characters() click to toggle source

@return [Array<String>]

# File lib/somemoji.rb, line 126
def noto_supported_characters
  ::JSON.parse(::File.read(noto_supported_characters_path))
end
twemoji_emojis() click to toggle source

@return [Array<Twemoji::Emoji>]

# File lib/somemoji.rb, line 131
def twemoji_emojis
  twemoji_supported_characters.map do |character|
    emoji_collection.find_by_character(character)
  end.compact
end
twemoji_supported_characters() click to toggle source

@return [Array<String>]

# File lib/somemoji.rb, line 138
def twemoji_supported_characters
  ::JSON.parse(::File.read(twemoji_supported_characters_path))
end