Class: TmSyntaxHighlighting::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/tm_syntax_highlighting/base.rb

Constant Summary collapse

@@attributes =
[:theme, :lang, :line_numbers, :current_themes]

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



52
53
54
# File 'lib/tm_syntax_highlighting/base.rb', line 52

def [](key)
  self.send(key)
end

.[]=(key, value) ⇒ Object



56
57
58
# File 'lib/tm_syntax_highlighting/base.rb', line 56

def []=(key, value)
  self.send("#{key}=", value)
end

.merge_with(opts) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/tm_syntax_highlighting/base.rb', line 68

def merge_with(opts)
  opts = self.options.merge(opts)
  if opts[:theme].is_a?(Array)
    opts[:theme] = opts[:theme][rand(opts[:theme].size)]
  end
  opts
end

.optionsObject



60
61
62
63
64
65
66
# File 'lib/tm_syntax_highlighting/base.rb', line 60

def options
  opts = {}
  @@attributes.each do |attribute|
    opts[attribute] = self.send(attribute)
  end
  opts
end

.reset_current_themesObject



76
77
78
# File 'lib/tm_syntax_highlighting/base.rb', line 76

def reset_current_themes
  self.current_themes = []
end