Class Origami::Array
In: sources/parser/array.rb
sources/parser/obfuscation.rb
Parent: ::Array

Class representing an Array Object. Arrays contain a set of Object.

Methods

+   <<   []=   new   pre_build   real_type   to_a   to_obfuscated_str   value  

Included Modules

Origami::Object

Public Class methods

Creates a new PDF Array Object.

data:An array of objects.

[Source]

    # File sources/parser/array.rb, line 48
48:     def initialize(data = [])
49:       
50:       unless data.is_a?(::Array)
51:         raise TypeError, "Expected type Array, received #{data.class}."
52:       end
53:       
54:       super()
55: 
56:       i = 0
57:       while i < data.size
58:         self[i] = data[i].to_o
59:         i = i + 1
60:       end
61:       
62:     end

Public Instance methods

[Source]

     # File sources/parser/array.rb, line 112
112:     def +(other)
113:       
114:       a = Origami::Array.new(self.to_a + other.to_a,  is_indirect?)
115:       a.no, a.generation = @no, @generation
116:       
117:       return a
118:     end

[Source]

     # File sources/parser/array.rb, line 120
120:     def <<(item)
121:       obj = item.to_o
122:       obj.parent = self
123: 
124:       super(obj)
125:     end

[Source]

     # File sources/parser/array.rb, line 127
127:     def []=(key,val)
128:       key, val = key.to_o, val.to_o
129:       super(key.to_o,val.to_o)
130: 
131:       val.parent = self
132: 
133:       val
134:     end

[Source]

    # File sources/parser/array.rb, line 64
64:     def pre_build
65:       self.map!{|obj| obj.to_o}
66:       
67:       super
68:     end

[Source]

     # File sources/parser/array.rb, line 138
138:     def real_type ; Origami::Array end

Converts self into a Ruby array.

[Source]

     # File sources/parser/array.rb, line 96
 96:     def to_a
 97:       super.map { |item|
 98:         item.is_a?(Origami::Object) ? item.value : item
 99:       }
100:     end

[Source]

     # File sources/parser/obfuscation.rb, line 132
132:     def to_obfuscated_str
133:       content = TOKENS.first + Obfuscator.junk_spaces
134:       self.each { |entry|
135:         content << entry.to_o.to_obfuscated_str + Obfuscator.junk_spaces
136:       }
137: 
138:       content << TOKENS.last
139: 
140:       super(content)
141:     end
value()

Alias for to_a

[Validate]