lib/rib/plugin.rb in rib-0.1.0 vs lib/rib/plugin.rb in rib-0.9.0

- old
+ new

@@ -1,10 +1,8 @@ module Rib; end module Rib::Plugin - Rib::P = self - def self.included mod mod.send(:include, Rib) class << mod attr_accessor :disabled @@ -26,11 +24,11 @@ def disabled? !!disabled end end - snake_name = mod.name[/::\w+$/].tr(':', ''). # remove namespaces - gsub(/([A-Z][a-z]*)/, '\\1_').downcase[0..-2] + snake_name = mod.name.sub(/(\w+::)+?(\w+)$/, '\2'). + gsub(/([A-Z][a-z]*)/, '\\1_').downcase[0..-2] code = (%w[enable disable].map{ |meth| <<-RUBY def #{meth}_#{snake_name} &block #{mod.name}.#{meth}(&block)