Module: Rouge::HasModes
- Included in:
- Themes::Base16, Themes::Github, Themes::Gruvbox
- Defined in:
- lib/rouge/theme.rb
Instance Method Summary collapse
- #get_mode(mode) ⇒ Object
- #mode(arg = :absent) ⇒ Object
- #mode!(arg) ⇒ Object
- #set_mode!(mode) ⇒ Object
Instance Method Details
#get_mode(mode) ⇒ Object
144 145 146 147 148 149 |
# File 'lib/rouge/theme.rb', line 144 def get_mode(mode) return self if self.mode == mode new_name = "#{self.name}.#{mode}" Class.new(self) { name(new_name); set_mode!(mode) } end |
#mode(arg = :absent) ⇒ Object
137 138 139 140 141 142 |
# File 'lib/rouge/theme.rb', line 137 def mode(arg=:absent) return @mode if arg == :absent @modes ||= {} @modes[arg] ||= get_mode(arg) end |
#mode!(arg) ⇒ Object
156 157 158 159 160 |
# File 'lib/rouge/theme.rb', line 156 def mode!(arg) alt_name = "#{self.name}.#{arg}" register(alt_name) set_mode!(arg) end |
#set_mode!(mode) ⇒ Object
151 152 153 154 |
# File 'lib/rouge/theme.rb', line 151 def set_mode!(mode) @mode = mode send("make_#{mode}!") end |