lib/rouge/theme.rb in rouge-2.0.7 vs lib/rouge/theme.rb in rouge-2.1.0

- old
+ new

@@ -109,13 +109,17 @@ def name(n=nil) return @name if n.nil? @name = n.to_s - Theme.registry[@name] = self + register(@name) end + def register(name) + Theme.registry[name.to_s] = self + end + def find(n) registry[n.to_s] end def registry @@ -134,15 +138,21 @@ def get_mode(mode) return self if self.mode == mode new_name = "#{self.name}.#{mode}" - Class.new(self) { name(new_name); mode!(mode) } + Class.new(self) { name(new_name); set_mode!(mode) } end + def set_mode!(mode) + @mode = mode + send("make_#{mode}!") + end + def mode!(arg) - @mode = arg - send("make_#{arg}!") + alt_name = "#{self.name}.#{arg}" + register(alt_name) + set_mode!(arg) end end class CSSTheme < Theme def initialize(opts={})