Module: Rouge::HasModes

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

Instance Method Summary collapse

Instance Method Details

#get_mode(mode) ⇒ Object



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

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



120
121
122
123
124
125
# File 'lib/rouge/theme.rb', line 120

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

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

#mode!(arg) ⇒ Object



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

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