Class: Emojidex::Data::Emoji

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

Overview

emoji base class

Instance Attribute Summary collapse

Attributes included from EmojiAssetInformation

#checksums, #paths, #remote_checksums

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?

Constructor Details

#initialize(details = {}) ⇒ Emoji

Returns a new instance of Emoji.



14
15
16
17
18
# File 'lib/emojidex/data/emoji.rb', line 14

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

Instance Attribute Details

#baseObject

Returns the value of attribute base.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def base
  @base
end

#categoryObject

Returns the value of attribute category.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def category
  @category
end

#codeObject

Returns the value of attribute code.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def code
  @code
end

#code_jaObject

Returns the value of attribute code_ja.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def code_ja
  @code_ja
end

#emoticonObject

Returns the value of attribute emoticon.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def emoticon
  @emoticon
end

#mojiObject

Returns the value of attribute moji.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def moji
  @moji
end

#r18Object

Returns the value of attribute r18.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def r18
  @r18
end

#tagsObject

Returns the value of attribute tags.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def tags
  @tags
end

#unicodeObject

Returns the value of attribute unicode.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def unicode
  @unicode
end

#variantsObject

Returns the value of attribute variants.



8
9
10
# File 'lib/emojidex/data/emoji.rb', line 8

def variants
  @variants
end

Instance Method Details

#[](key) ⇒ Object



36
37
38
# File 'lib/emojidex/data/emoji.rb', line 36

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

#[]=(key, val) ⇒ Object



40
41
42
# File 'lib/emojidex/data/emoji.rb', line 40

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

#to_hashObject



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

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



24
25
26
# File 'lib/emojidex/data/emoji.rb', line 24

def to_json(*args)
  to_hash.to_json(*args)
end

#to_sObject



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

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