Methods
Classes and Modules
Module Syntax::ConvertorsModule 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
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 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