Method: CodeRay::Encoders::Encoder#initialize

Defined in:
lib/coderay/encoder.rb

#initialize(options = {}) ⇒ Encoder

Creates a new Encoder. options is saved and used for all encode operations, as long as you don’t overwrite it there by passing additional options.

Encoder objects provide three encode methods:

  • encode simply takes a code string and a lang

  • encode_tokens expects a tokens object instead

Each method has an optional options parameter. These are added to the options you passed at creation.



66
67
68
69
# File 'lib/coderay/encoder.rb', line 66

def initialize options = {}
  @options = self.class::DEFAULT_OPTIONS.merge options
  @@CODERAY_TOKEN_INTERFACE_DEPRECATION_WARNING_GIVEN = false
end