Module: Rouge::HasModes

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

Instance Method Summary collapse

Instance Method Details

#get_mode(mode) ⇒ Object


114
115
116
117
118
119
# File 'lib/rouge/theme.rb', line 114

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


107
108
109
110
111
112
# File 'lib/rouge/theme.rb', line 107

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

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

#mode!(arg) ⇒ Object


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

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