Parent

Included Modules

Class/Module Index [+]

Quicksearch

Origami::Name

Class representing a Name Object. Name objects are strings which identify some PDF file inner structures.

Public Class Methods

native_type() click to toggle source
# File lib/origami/name.rb, line 166
def self.native_type ; Name end
new(name = "") click to toggle source

Creates a new Name.

name

A symbol representing the new Name value.

# File lib/origami/name.rb, line 74
def initialize(name = "")
  unless name.is_a?(Symbol) or name.is_a?(::String)
    raise TypeError, "Expected type Symbol or String, received #{name.class}."
  end
  
  @value = name.to_s
  
  super()
end

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
value() click to toggle source
# File lib/origami/name.rb, line 85
def value   
  ( @value.empty? ) ? EmptySymbol.new : @value.to_sym
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.