module Fontist::Helpers
Public Class Methods
Source
# File lib/fontist/helpers.rb, line 10 def self.run(command) Fontist.ui.debug("Run `#{command}`") result = `#{command}` unless $CHILD_STATUS.to_i.zero? raise Errors::BinaryCallError, "Failed to run #{command}, status: #{$CHILD_STATUS}" end result end
Source
# File lib/fontist/helpers.rb, line 22 def self.silence_stream(stream) old_stream = stream.dup stream.reopen(RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? File::NULL : File::NULL) # rubocop:disable Performance/RegexpMatch, Layout/LineLength stream.sync = true yield ensure stream.reopen(old_stream) end
Source
# File lib/fontist/helpers.rb, line 3 def self.url_object(request) return request unless request.include?("\"url\"") obj = JSON.parse(request.gsub("=>", ":")) Struct.new(:url, :headers).new(obj["url"], obj["headers"]) end