Sha256: 1ed041e73b782ca31b4a3429d43431a848ead00c9a5fd14553db89e3f302ee42

Contents?: true

Size: 669 Bytes

Versions: 6

Compression:

Stored size: 669 Bytes

Contents

require 'phantom_svg'

module Emojidex
  # compile svg files in a svg animation file
  class Preprocessor
    def compile_svg_animations(path)
      Dir.entries(path).each do |file|
        current_path = "#{path}/#{file}"
        next unless File.ftype(current_path) == 'directory'
        _svg_compile(current_path) unless file.start_with?('.')
      end
    end

    private

    def _svg_compile(source_dir)
      json_path = "#{source_dir}/animation.json"

      return unless File.exist?(json_path)

      phantom_svg = Phantom::SVG::Base.new(json_path)
      phantom_svg.save_svg("#{File.dirname(source_dir)}/#{File.basename(source_dir)}.svg")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
emojidex-converter-0.4.1 lib/emojidex/preprocessor.rb
emojidex-converter-0.4.0 lib/emojidex/preprocessor.rb
emojidex-converter-0.3.3 lib/emojidex/preprocessor.rb
emojidex-converter-0.3.2 lib/emojidex/preprocessor.rb
emojidex-converter-0.3.1 lib/emojidex/preprocessor.rb
emojidex-converter-0.3.0 lib/emojidex/preprocessor.rb