module Textpow
Constants
- RUBY_19
- VERSION
Public Class Methods
syntax(syntax_name)
click to toggle source
# File lib/textpow.rb, line 16 def self.syntax(syntax_name) syntax_name = syntax_name.downcase if @@syntax.has_key?(syntax_name) @@syntax[syntax_name] else @@syntax[syntax_name] = uncached_syntax(syntax_name) end end
syntax_path()
click to toggle source
# File lib/textpow.rb, line 11 def self.syntax_path File.join(File.dirname(__FILE__), 'textpow', 'syntax') end
Private Class Methods
find_syntax_by_fuzzy_name(name)
click to toggle source
# File lib/textpow.rb, line 41 def self.find_syntax_by_fuzzy_name(name) path = Dir.glob(File.join(syntax_path, "*.#{name}.*")).sort_by(&:size).first path if path and File.exist?(path) end
find_syntax_by_path(path)
click to toggle source
# File lib/textpow.rb, line 46 def self.find_syntax_by_path(path) path if File.file?(path) end
find_syntax_by_scope_name(name)
click to toggle source
# File lib/textpow.rb, line 36 def self.find_syntax_by_scope_name(name) path = File.join(syntax_path, "#{name}.syntax") path if File.exist?(path) end
uncached_syntax(name)
click to toggle source
# File lib/textpow.rb, line 27 def self.uncached_syntax(name) path = ( find_syntax_by_path(name) || find_syntax_by_scope_name(name) || find_syntax_by_fuzzy_name(name) ) SyntaxNode.load(path) if path end