module XCPretty

Constants

VERSION

Public Class Methods

class_from_path(path) click to toggle source
# File lib/xcpretty.rb, line 18
def self.class_from_path(path)
  source = File.read(path)
  klass = eval(source, nil, path)
  raise unless klass.is_a?(Class)
  klass
end
exit_with_error(message) click to toggle source
# File lib/xcpretty.rb, line 32
def self.exit_with_error(message)
  $stderr.puts "[!] #{message}"
  exit 1
end
load_custom_class(path) click to toggle source
# File lib/xcpretty.rb, line 25
def self.load_custom_class(path)
  $LOAD_PATH.unshift File.dirname(path)
  class_from_path(path)
rescue SyntaxError => e
  exit_with_error("Expected custom source file to return a class. #{e}")
end