Module: Fontist::Helpers
- Defined in:
 - lib/fontist/helpers.rb
 
Class Method Summary collapse
Class Method Details
.parse_to_object(data) ⇒ Object
      5 6 7  | 
    
      # File 'lib/fontist/helpers.rb', line 5 def self.parse_to_object(data) JSON.parse(data.to_json, object_class: OpenStruct) end  | 
  
.run(command) ⇒ Object
      9 10 11 12 13 14 15 16 17 18 19  | 
    
      # File 'lib/fontist/helpers.rb', line 9 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  | 
  
.silence_stream(stream) ⇒ Object
      21 22 23 24 25 26 27 28  | 
    
      # File 'lib/fontist/helpers.rb', line 21 def self.silence_stream(stream) old_stream = stream.dup stream.reopen(RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "NUL:" : "/dev/null") # rubocop:disable Performance/RegexpMatch, Metrics/LineLength stream.sync = true yield ensure stream.reopen(old_stream) end  |