Class: Syntax::Convertors::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax/convertors/abstract.rb

Overview

The abstract ancestor class for all convertors. It implements a few convenience methods to provide a common interface for all convertors.

Direct Known Subclasses

HTML

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokenizer) ⇒ Abstract

Creates a new convertor that uses the given tokenizer.



20
21
22
# File 'lib/syntax/convertors/abstract.rb', line 20

def initialize( tokenizer )
  @tokenizer = tokenizer
end

Instance Attribute Details

#tokenizerObject (readonly)

A reference to the tokenizer used by this convertor.



11
12
13
# File 'lib/syntax/convertors/abstract.rb', line 11

def tokenizer
  @tokenizer
end

Class Method Details

.for_syntax(syntax) ⇒ Object

A convenience method for instantiating a new convertor for a specific syntax.



15
16
17
# File 'lib/syntax/convertors/abstract.rb', line 15

def self.for_syntax( syntax )
  new( Syntax.load( syntax ) )
end