Class | Origami::Name |
In: |
sources/parser/obfuscation.rb
sources/parser/name.rb |
Parent: | Object |
name: | A symbol representing the new Name value. |
# File sources/parser/name.rb, line 51 51: def initialize(name = "", indirect = false) 52: 53: unless name.is_a?(Symbol) or name.is_a?(::String) 54: raise TypeError, "Expected type Symbol or String, received #{name.class}." 55: end 56: 57: value = (name.to_s.empty?) ? " "" " : name.to_sym 58: 59: super(indirect, value) 60: 61: end
# File sources/parser/obfuscation.rb, line 181 181: def to_obfuscated_str(prop = 2) 182: name = (self.value == " "" ") ? "" : self.id2name 183: 184: forbiddenchars = [ " ","#","\t","\r","\n","\0","[","]","<",">","(",")","%","/","\\" ] 185: 186: name.gsub!(/./) do |c| 187: if rand(prop) == 0 or forbiddenchars.include?(c) 188: hexchar = c[0].to_s(base=16) 189: hexchar = "0" + hexchar if hexchar.length < 2 190: 191: '#' + hexchar 192: else 193: c 194: end 195: end 196: 197: print(TOKENS.first + name) 198: end