Module: Rouge::HasModes

Included in:
Themes::Base16, Themes::Gruvbox
Defined in:
lib/rouge/theme.rb

Instance Method Summary collapse

Instance Method Details

#get_mode(mode) ⇒ Object



139
140
141
142
143
144
# File 'lib/rouge/theme.rb', line 139

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



132
133
134
135
136
137
# File 'lib/rouge/theme.rb', line 132

def mode(arg=:absent)
  return @mode if arg == :absent

  @modes ||= {}
  @modes[arg] ||= get_mode(arg)
end

#mode!(arg) ⇒ Object



151
152
153
154
155
# File 'lib/rouge/theme.rb', line 151

def mode!(arg)
  alt_name = "#{self.name}.#{arg}"
  register(alt_name)
  set_mode!(arg)
end

#set_mode!(mode) ⇒ Object



146
147
148
149
# File 'lib/rouge/theme.rb', line 146

def set_mode!(mode)
  @mode = mode
  send("make_#{mode}!")
end