Class: EideticPDF::PdfObjects::PdfArray

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/epdfo.rb

Direct Known Subclasses

Rectangle

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = [], wrap = 0) ⇒ PdfArray

Returns a new instance of PdfArray.



243
244
245
# File 'lib/epdfo.rb', line 243

def initialize(values=[], wrap=0)
  @values, @wrap = values, wrap
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



240
241
242
# File 'lib/epdfo.rb', line 240

def values
  @values
end

#wrapObject

Returns the value of attribute wrap.



241
242
243
# File 'lib/epdfo.rb', line 241

def wrap
  @wrap
end

Instance Method Details

#==(other) ⇒ Object



263
264
265
266
# File 'lib/epdfo.rb', line 263

def ==(other)
  (other.respond_to?(:values) && self.values == other.values) &&
  (other.respond_to?(:wrap) && self.wrap == other.wrap)
end

#eachObject



251
252
253
254
255
256
257
# File 'lib/epdfo.rb', line 251

def each
  if wrap.zero?
    yield values
  else
    0.step(values.size, wrap) { |i| yield values[i, wrap] }
  end
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


259
260
261
# File 'lib/epdfo.rb', line 259

def eql?(other)
  self.values.eql?(other.values) && self.wrap.eql?(other.wrap)
end

#to_sObject



247
248
249
# File 'lib/epdfo.rb', line 247

def to_s
  "[#{wrapped_values}] "
end