Sha256: 338aa940fe390e4802137471256cf9d164aebbaf478d1677aa1cb337c5408be2

Contents?: true

Size: 366 Bytes

Versions: 6

Compression:

Stored size: 366 Bytes

Contents

module XCPretty
  class Syntax

    def self.highlight(code)
      pygments_available? ? pygmentize(code) : code
    end


    private

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

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

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xcpretty-0.1.2 lib/xcpretty/syntax.rb
xcpretty-0.1.1 lib/xcpretty/syntax.rb
xcpretty-0.1.0 lib/xcpretty/syntax.rb
xcpretty-0.0.9 lib/xcpretty/syntax.rb
xcpretty-0.0.8 lib/xcpretty/syntax.rb
xcpretty-0.0.7 lib/xcpretty/syntax.rb