Class: Swift::Playground::Util::SyntaxHighlighting

Inherits:
Object
  • Object
show all
Defined in:
lib/swift/playground/util/syntax_highlighting.rb

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/swift/playground/util/syntax_highlighting.rb', line 8

def available?
  Gem::Specification::find_all_by_name('github-linguist').any? &&
  Gem::Specification::find_all_by_name('pygments.rb').any?
end

.css(style = 'default') ⇒ Object



13
14
15
16
17
18
19
# File 'lib/swift/playground/util/syntax_highlighting.rb', line 13

def css(style = 'default')
  if available?
    Pygments.css('.highlight', style: style)
  else
    ''
  end
end