Class: Emojidex::Data::Emoji

Inherits:
Object
  • Object
show all
Includes:
EmojiAssetInformation, EmojiComponentSetInformation
Defined in:
lib/emojidex/data/emoji.rb

Overview

emoji base class

Instance Attribute Summary collapse

Attributes included from EmojiAssetInformation

#checksums, #paths, #remote_checksums

Attributes included from EmojiComponentSetInformation

#combinations, #customizations

Instance Method Summary collapse

Methods included from EmojiAssetInformation

#blank_checksums, #blank_paths, #cache, #checksum?, #fill_checksums, #fill_paths, #fill_remote_checksums, #generate_checksum, #generate_checksums, #init_asset_info, #path, #path?

Methods included from EmojiComponentSetInformation

#add_combination, #add_customization, #fill_combinations, #init_combination_info

Constructor Details

#initialize(details = {}) ⇒ Emoji

Returns a new instance of Emoji.



27
28
29
30
31
32
# File 'lib/emojidex/data/emoji.rb', line 27

def initialize(details = {})
  _init_identifier_info(details)
  _init_descriptor_info(details)
  init_combination_info(details)
  init_asset_info(details)
end

Instance Attribute Details

#baseObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def base
  @base
end

#categoryObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def category
  @category
end

#codeObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def code
  @code
end

#code_jaObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def code_ja
  @code_ja
end

#emoticonObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def emoticon
  @emoticon
end

#mojiObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def moji
  @moji
end

#r18Object

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def r18
  @r18
end

#tagsObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def tags
  @tags
end

#unicodeObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def unicode
  @unicode
end

#variantsObject

Attribute Definitions:

  • moji: the actual character code associated with this emoji (if any)

  • category: category this emoji belongs to (usually as defined by Unicode)

  • code: the “short code” for the emoji

  • code_ja: the Japanese version of the “short code”

  • unicode: a string representing the hex of the unicode characters with - between multiples

  • tags: the tags registered to this emoji (usually only from the service)

  • emoticon: the emoticon that maps to this emoji (rarely used/not recommended)

  • variants: different (variants) of the emoji EG: racial modifiers

  • base: the base variant EG: the base emoji without modifiers

  • r18: flag indicating adult content



20
21
22
# File 'lib/emojidex/data/emoji.rb', line 20

def variants
  @variants
end

Instance Method Details

#[](key) ⇒ Object



55
56
57
# File 'lib/emojidex/data/emoji.rb', line 55

def [](key)
  instance_variable_get(key.to_s.delete(':').insert(0, '@'))
end

#[]=(key, val) ⇒ Object



59
60
61
# File 'lib/emojidex/data/emoji.rb', line 59

def []=(key, val)
  instance_variable_set(key.to_s.delete(':').insert(0, '@'), val)
end

#to_hashObject



47
48
49
50
51
52
53
# File 'lib/emojidex/data/emoji.rb', line 47

def to_hash
  hash = {}
  instance_variables.each do |key|
    hash[key.to_s.delete('@')] = instance_variable_get(key)
  end
  hash
end

#to_json(*args) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/emojidex/data/emoji.rb', line 38

def to_json(*args)
  hash = to_hash
  hash.each do |key, val|
    hash.delete(key) if (val.instance_of?(Array) && val.length == 0)
    hash.delete(key) if (val.instance_of?(String) && val == "")
  end
  hash.to_json(*args)
end

#to_sObject



34
35
36
# File 'lib/emojidex/data/emoji.rb', line 34

def to_s
  @moji || Emojidex.encapsulate_code(@code)
end