Module: Syntax

Module Syntax |
In: | lib/syntax.rb lib/syntax/common.rb lib/syntax/version.rb lib/syntax/convertors/abstract.rb lib/syntax/convertors/html.rb lib/syntax/lang/ruby.rb lib/syntax/lang/xml.rb lib/syntax/lang/yaml.rb

Methods

- all
- load

Classes and Modules
Module Syntax::Convertors
Module Syntax::Version
Class Syntax::Default
Class Syntax::Ruby
Class Syntax::Token
Class Syntax::Tokenizer
Class Syntax::XML
Class Syntax::YAML
Constants

SYNTAX | = | Hash.new( Default )
| A hash for registering syntax implementations.

Public Instance methods
all()

Return an array of the names of supported syntaxes.

[ show source ]

        # File lib/syntax.rb, line 32
    32:   def all
    33:     lang_dir = File.join(File.dirname(__FILE__), "syntax", "lang")
    34:     Dir["#{lang_dir}/*.rb"].map { |path| File.basename(path, ".rb") }
    35:   end

load( syntax )

Load the implementation of the requested syntax. If the syntax cannot be found, or if it cannot be loaded for whatever reason, the Default syntax handler will be returned.

[ show source ]

        # File lib/syntax.rb, line 22
    22:   def load( syntax )
    23:     begin
    24:       require "syntax/lang/#{syntax}"
    25:     rescue LoadError
    26:     end
    27:     SYNTAX[ syntax ].new
    28:   end