Class Pygments::Lexer
In: lib/pygments/lexer.rb
Parent: Struct.new(:name, :aliases, :filenames, :mimetypes)

Methods

External Aliases

equal? -> ==
equal? -> eql?

Public Class methods

Public: Alias for find.

Public: Get all Lexers

Returns an Array of Lexers

Internal: Create a new Lexer object

hash - A hash of attributes

Returns a Lexer object

Public: Look up Lexer by name or alias.

name - A String name or alias

  Lexer.find('Ruby')
  => #<Lexer name="Ruby">

Returns the Lexer or nil if none was found.

Public: Look up Lexer by one of its aliases.

name - A String alias of the Lexer

Examples

  Lexer.find_by_alias('rb')
  # => #<Lexer name="Ruby">

Returns the Lexer or nil if none was found.

Public: Look up Lexer by one of it‘s file extensions.

extname - A String file extension.

Examples

 Lexer.find_by_extname('.rb')
 # => #<Lexer name="Ruby">

Returns the Lexer or nil if none was found.

Public: Look up Lexer by one of it‘s mime types.

type - A mime type String.

Examples

 Lexer.find_by_mimetype('application/x-ruby')
 # => #<Lexer name="Ruby">

Returns the Lexer or nil if none was found.

Public: Look up Lexer by its proper name.

name - The String name of the Lexer

Examples

  Lexer.find_by_name('Ruby')
  # => #<Lexer name="Ruby">

Returns the Lexer or nil if none was found.

Public Instance methods

Public: Highlight syntax of text

text - String of code to be highlighted options - Hash of options (defaults to {})

Returns html String

[Validate]