Method: HexaPDF::Content::LineDashPattern#initialize

Defined in:
lib/hexapdf/content/graphics_state.rb

#initialize(array = [], phase = 0) ⇒ LineDashPattern

Inititalizes the line dash pattern with the given array and phase.

The argument phase must be non-negative and the numbers in the array must be non-negative and must not all be zero.



253
254
255
256
257
258
259
260
# File 'lib/hexapdf/content/graphics_state.rb', line 253

def initialize(array = [], phase = 0)
  if phase < 0 || (!array.empty? &&
    array.inject(0) {|m, n| m < 0 ? m : (n < 0 ? -1 : m + n) } <= 0)
    raise ArgumentError, "Invalid line dash pattern: #{array.inspect} #{phase.inspect}"
  end
  @array = array
  @phase = phase
end