Class: HParser::Util::AllParser
- Inherits:
-
Object
- Object
- HParser::Util::AllParser
- Defined in:
- lib/hparser/util/parser.rb
Class Method Summary collapse
-
.includes(mod) ⇒ Object
Retutrn array of all usable parser.
Class Method Details
.includes(mod) ⇒ Object
Retutrn array of all usable parser.
This method collect all classes/modules which include mod module. And sorting those by <=>.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/hparser/util/parser.rb', line 78 def self.includes(mod) parser = [] ObjectSpace.each_object(Class){|klass| next if klass.name.nil? || !klass.name.start_with?('HParser::') if klass.include?(mod) then parser.push klass end } # sorting parser. # e.g. Parser P should be after any other parser. parser.sort{|a,b| a <=> b or -(b <=> a).to_i } end |