Sha256: 6d43ec64d5d0d2a83dd08e812fa543fd16c510d5d52672828de09a4f6a76e2d1

Contents?: true

Size: 406 Bytes

Versions: 3

Compression:

Stored size: 406 Bytes

Contents

module XCPretty
  class Syntax

    def self.highlight(code, options="")
      pygments_available? ? pygmentize(code, options) : code
    end


    private

    def self.pygments_available?
      @available = system('which pygmentize > /dev/null') if @available.nil?
      @available
    end

    def self.pygmentize(code, options)
      `echo "#{code}" | pygmentize -l objc #{options}`
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcpretty-0.1.5 lib/xcpretty/syntax.rb
xcpretty-0.1.4 lib/xcpretty/syntax.rb
xcpretty-0.1.3 lib/xcpretty/syntax.rb