Class: Cjoiner::Engines::UndebugJS

Inherits:
Engine
  • Object
show all
Defined in:
lib/cjoiner/engines/undebugjs.rb

Overview

eliminates js debug statements

Instance Attribute Summary

Attributes inherited from Engine

#engine

Instance Method Summary collapse

Methods inherited from Engine

#render

Methods included from Helpers::Files

#delete_file, #expand_path, #file, #file_exists, #load_yaml, #move_file, #on_windows, #read_file, #temp_file, #write_file

Constructor Details

#initialize(opts) ⇒ UndebugJS

Returns a new instance of UndebugJS.



5
6
7
8
9
# File 'lib/cjoiner/engines/undebugjs.rb', line 5

def initialize(opts)
  @keywords = []
  set_keywords!
  @engine = replace(opts[:content], opts[:prefix])
end

Instance Method Details

#add_keyword(keyword) ⇒ Object



11
12
13
# File 'lib/cjoiner/engines/undebugjs.rb', line 11

def add_keyword(keyword)
  @keywords << keyword
end

#set_keywords!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cjoiner/engines/undebugjs.rb', line 15

def set_keywords!
  add_keyword 'assert'
  add_keyword 'clear'
  add_keyword 'count'
  add_keyword 'debug'
  add_keyword 'dir'
  add_keyword 'dirxml'
  add_keyword 'error'
  add_keyword 'group'
  add_keyword 'groupCollapsed'
  add_keyword 'groupEnd'
  add_keyword 'info'
  add_keyword 'log'
  add_keyword 'profile'
  add_keyword 'profileEnd'
  add_keyword 'time'
  add_keyword 'timeEnd'
  add_keyword 'timeStamp'
  add_keyword 'trace'
  add_keyword 'warn'
  add_keyword 'debugger'
  add_keyword 'ungroup'
end