Class: Rouge::Lexers::JSON

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/javascript.rb

Class Method Summary collapse

Methods inherited from RegexLexer

[], #get_state, get_state, #initialize, state, states, #step, #stream_tokens, #stream_with_state

Methods inherited from Rouge::Lexer

aliases, #debug, default_options, filenames, find, #get_tokens, guess, guess_by_filename, guess_by_mimetype, guess_by_source, #initialize, lex, #lex, make, mimetypes, new, #option, #options, register, #stream_tokens, tag

Constructor Details

This class inherits a constructor from Rouge::RegexLexer

Class Method Details

.analyze_text(text) ⇒ Object

TODO: is this too much of a performance hit? JSON is quite simple, so I’d think this wouldn’t be too bad, but for large documents this could mean doing two full lexes.



104
105
106
# File 'lib/rouge/lexers/javascript.rb', line 104

def self.analyze_text(text)
  text.lexes_cleanly?(self) ? 0.8 : 0
end