Sha256: 0c2e047e996e63c22401ea9142e6a7cac89a9aa95e66fac48e5e4c784ce6a690

Contents?: true

Size: 1.01 KB

Versions: 16

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../service/transactor'
require_relative '../../env_helper'

module Emojidex
  module Data
    # mixin module to enable static collections
    module StaticCollection
      def load_from_server(detailed = true, locale = '??')
        locale = @locale || Emojidex::EnvHelper.lang? if locale == '??'
        begin
          res = Emojidex::Service::Transactor.get(@endpoint, detailed: detailed, locale: locale)
        rescue
          false
        end
        add_emoji(res)
        true
      end

      def check_and_load_static(collection)
        loaded = false
        if defined? Emojidex::Vectors
          @vector_source_path = Emojidex::Vectors.path + "/#{collection}/"
          load_local_collection @vector_source_path
          loaded = true
        end
        if defined? Emojidex::Rasters
          @raster_source_path = Emojidex::Rasters.path + "/#{collection}/"
          load_local_collection @raster_source_path
          loaded = true
        end
        loaded
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
emojidex-0.5.3 lib/emojidex/data/collection/static_collection.rb
emojidex-0.5.2 lib/emojidex/data/collection/static_collection.rb
emojidex-0.5.1 lib/emojidex/data/collection/static_collection.rb
emojidex-0.5.0 lib/emojidex/data/collection/static_collection.rb
emojidex-0.4.2 lib/emojidex/data/collection/static_collection.rb
emojidex-0.4.1 lib/emojidex/data/collection/static_collection.rb
emojidex-0.4.0 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.5 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.4 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.3 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.2 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.1 lib/emojidex/data/collection/static_collection.rb
emojidex-0.3.0 lib/emojidex/data/collection/static_collection.rb
emojidex-0.2.3 lib/emojidex/data/collection/static_collection.rb
emojidex-0.2.2 lib/emojidex/data/collection/static_collection.rb
emojidex-0.2.1 lib/emojidex/data/collection/static_collection.rb