Class | Ohcount::Gestalt::Rule |
In: |
lib/gestalt/rules/rule.rb
|
Parent: | Object |
# File lib/gestalt/rules/rule.rb, line 33 def self.method_missing(m,*args) if /(.*)_keywords$/ =~ m.to_s language = $1 return rules << KeywordLibraryRule.new(language,args) end super end
when tallying up libraries, its easier to use symbol names instead of class names to_sym maps FooLib to :foo_lib
# File lib/gestalt/rules/rule.rb, line 20 def self.to_sym @symbol ||= begin to_s =~ /([^:]*)$/ naked_classname = $1 chars = naked_classname.scan(/./) chars[0] = chars[0].downcase ruby_s = chars.collect do |char| char.downcase == char ? char : "_" + char.downcase end.to_s ruby_s.intern end end