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 = [], indirect = false)
49:       
50:       unless data.is_a?(::Array)
51:         raise TypeError, "Expected type Array, received #{data.class}."
52:       end
53:       
54:       super(indirect)
55: 
56:       for i in 0..data.size-1 do
57:         self[i] = data[i].to_o
58:       end
59:       
60:     end

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

Converts self into a Ruby array.

[Source]

    # File sources/parser/array.rb, line 94
94:     def to_a
95:       super.map { |item|
96:         item.is_a?(Origami::Object) ? item.value : item
97:       }
98:     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:       print(content)
141:     end
value()

Alias for to_a

[Validate]