Sha256: b90770713f22d07cdc6920c2643bdbf98c601b061c945dfeee9f09d2e1ce8263

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require_relative 'component_set_asset_information.rb'

module Emojidex
  module Data
    # Combination information container
    class ComponentSet
      # * 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)
      attr_accessor :base, :component_layer_order, :components

      include Emojidex::Data::EmojiComponentSetAssetInformation

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

        @components = combination_info[:components]
        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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
emojidex-0.5.3 lib/emojidex/data/emoji/component_set.rb
emojidex-0.5.2 lib/emojidex/data/emoji/component_set.rb
emojidex-0.5.1 lib/emojidex/data/emoji/component_set.rb
emojidex-0.5.0 lib/emojidex/data/emoji/component_set.rb