Sha256: 2458502a59a9dd2b78c1e7ec45870c26d7f860781d4612243b2ba5df326faf63

Contents?: true

Size: 659 Bytes

Versions: 10

Compression:

Stored size: 659 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'
        compile(current_path) unless file.start_with?('.')
      end
    end

    private

    def 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

10 entries across 10 versions & 1 rubygems

Version Path
emojidex-converter-0.2.1 lib/emojidex/preprocessor.rb
emojidex-converter-0.2.0 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.8 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.7 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.6 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.5 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.4 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.3 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.2 lib/emojidex/preprocessor.rb
emojidex-converter-0.0.1 lib/emojidex/preprocessor.rb