Class: Emojidex::Data::Combination

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

Overview

Combination information container

Instance Attribute Summary collapse

Attributes included from EmojiCombinationAssetInformation

#checksums, #paths, #remote_checksums

Instance Method Summary collapse

Methods included from EmojiCombinationAssetInformation

#blank_checksums, #blank_paths, #fill_paths, #fill_remote_checksums, #generate_blank_entry_set, #generate_blank_path_set, #generate_checksum, #generate_checksums, #init_asset_info

Constructor Details

#initialize(code, combination_info, details = {}) ⇒ Combination

Returns a new instance of Combination.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/emojidex/data/emoji/combination.rb', line 14

def initialize(code, combination_info, details = {})
  @base = combination_info[:base]

  @components = []
  @components << [Emojidex.escape_code(code.to_s)]
  combination_info[:components].each { |component_set| @components << component_set }
  if combination_info.include? :component_layer_order
    @component_layer_order = combination_info[:component_layer_order]
  else
    @component_layer_order = []
    for i in 0..(@components.length - 1)
      @component_layer_order << i
    end
  end

  init_asset_info(details)
end

Instance Attribute Details

#baseObject

  • base: the named base that this combination belongs to

  • combinations: combinations starting with this emoji; base/components/component order

  • cutomizations: emoji which start customization of this emoji (this is combination base)



10
11
12
# File 'lib/emojidex/data/emoji/combination.rb', line 10

def base
  @base
end

#component_layer_orderObject

  • base: the named base that this combination belongs to

  • combinations: combinations starting with this emoji; base/components/component order

  • cutomizations: emoji which start customization of this emoji (this is combination base)



10
11
12
# File 'lib/emojidex/data/emoji/combination.rb', line 10

def component_layer_order
  @component_layer_order
end

#componentsObject

  • base: the named base that this combination belongs to

  • combinations: combinations starting with this emoji; base/components/component order

  • cutomizations: emoji which start customization of this emoji (this is combination base)



10
11
12
# File 'lib/emojidex/data/emoji/combination.rb', line 10

def components
  @components
end

Instance Method Details

#to_json(options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/emojidex/data/emoji/combination.rb', line 32

def to_json(options = {})
  truncated_components = @components.dup
  truncated_components.shift
  {
    base: @base,
    component_layer_order: @component_layer_order,
    components: truncated_components,
    checksums: @checksums
  }.to_json
end