Module: FiltSymbols
- Defined in:
- lib/codeobscure/filtsymbols.rb
Constant Summary collapse
- @@filt_db_path =
"#{File.expand_path '../../..', __FILE__}/filtSymbols"- @@table_name =
"symbols"- @@key_words =
["interface","NSInteger","BOOL","Class","free","M_PI_2","abort","change","top","bottom","NSUIntegerMax","intoString"]
Class Method Summary collapse
- .createTable ⇒ Object
- .insertValue(line) ⇒ Object
- .loadFiltSymbols(path) ⇒ Object
- .query(line) ⇒ Object
Class Method Details
.createTable ⇒ Object
8 9 10 11 12 |
# File 'lib/codeobscure/filtsymbols.rb', line 8 def self.createTable if !File.exist? @@filt_db_path `echo "create table #{@@table_name}(src text,PRIMARY KEY (src));" | sqlite3 #{@@filt_db_path}` end end |
.insertValue(line) ⇒ Object
14 15 16 |
# File 'lib/codeobscure/filtsymbols.rb', line 14 def self.insertValue(line) `echo "insert or ignore into #{@@table_name} values('#{line}');" | sqlite3 #{@@filt_db_path}` end |
.loadFiltSymbols(path) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/codeobscure/filtsymbols.rb', line 22 def self.loadFiltSymbols(path) createTable funclist_path = FuncList.genFuncList path , "h" , false puts "处理中,可能需要一段时间,耐心等候...".colorize(:yellow) symbol_file = File.open(funclist_path).read symbol_file.each_line do |line| line_content = line.rstrip.split(":").last insertValue line_content end @@key_words.each do |word| insertValue word end if File.exist? funclist_path `rm -f #{funclist_path}` end `sqlite3 #{@@filt_db_path} .dump` end |
.query(line) ⇒ Object
18 19 20 |
# File 'lib/codeobscure/filtsymbols.rb', line 18 def self.query(line) `echo "select * from #{@@table_name} where src='#{line}';" | sqlite3 #{@@filt_db_path}` end |