Sha256: a0fa5b11bf53d9bf457e6e7995bbf38e96f3741701a21dff658ce23f35c09b47

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

module Rabbit
  module Parser
    module Ext
      module AAFigure
        module_function
        AVAILABLE_OPTIONS = ["linewidth", "foreground", "fill", "background",
                             "option"]
        def make_image_by_aafigure(path, prop, logger)
          image_file = Tempfile.new("rabbit-image-aafigure")
          command = ["aafigure",
                     "--type", "svg",
                     "--encoding", "utf-8",
                     "--output", image_file.path]
          aafigure_options = []
          AVAILABLE_OPTIONS.each do |name|
            command.concat(["--#{name}", prop[name]]) if prop.has_key?(name)
          end
          command << path
          if SystemRunner.run(*command)
            image_file
          else
            format = _("tried aafigure command: %s")
            additional_info = format % command.inspect
            raise AAFigureCanNotHandleError.new(command.join(' '),
                                                additional_info)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rabbit-0.9.3 lib/rabbit/parser/ext/aafigure.rb
rabbit-0.9.2 lib/rabbit/parser/ext/aafigure.rb
rabbit-0.9.1 lib/rabbit/parser/ext/aafigure.rb
rabbit-0.9.0 lib/rabbit/parser/ext/aafigure.rb