Class | Origami::Array |
In: |
sources/parser/array.rb
sources/parser/obfuscation.rb |
Parent: | ::Array |
Creates a new PDF Array Object.
data: | An array of objects. |
# 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
# 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
# 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
# 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
# File sources/parser/array.rb, line 64 64: def pre_build 65: self.map!{|obj| obj.to_o} 66: 67: super 68: end
Converts self into a Ruby array.
# 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