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)


12
13
14
15
# File 'lib/swift/playground/util/syntax_highlighting.rb', line 12

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



17
18
19
20
21
22
23
# File 'lib/swift/playground/util/syntax_highlighting.rb', line 17

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