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



135
136
137
138
139
140
# File 'lib/rouge/theme.rb', line 135

def get_mode(mode)
  return self if self.mode == mode

  new_name = "#{self.name}.#{mode}"
  Class.new(self) { name(new_name); mode!(mode) }
end

#mode(arg = :absent) ⇒ Object



128
129
130
131
132
133
# File 'lib/rouge/theme.rb', line 128

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

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

#mode!(arg) ⇒ Object



142
143
144
145
# File 'lib/rouge/theme.rb', line 142

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