Parent

Origami::Name

Public Instance Methods

to_obfuscated_str(prop = 2) click to toggle source
# File lib/origami/obfuscation.rb, line 185
def to_obfuscated_str(prop = 2)
  name = @value.dup
  
  forbiddenchars = [ " ","#","\t","\r","\n","\00"","[","]","<",">","(",")","%","/","\\" ]

  name.gsub!(/./) do |c|
    if rand(prop) == 0 or forbiddenchars.include?(c)
      hexchar = c[0].to_s(base=16)
      hexchar = "0" + hexchar if hexchar.length < 2
      
      '#' + hexchar
    else
      c
    end
  end

  super(TOKENS.first + name)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.