Class: EideticPDF::ColorStack

Inherits:
Object
  • Object
show all
Defined in:
lib/epdfs.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(obj, prop) ⇒ ColorStack

Returns a new instance of ColorStack.



60
61
62
63
# File 'lib/epdfs.rb', line 60

def initialize(obj, prop)
  @obj, @prop = obj, prop
  @stack = []
end

Instance Method Details

#popObject



70
71
72
73
# File 'lib/epdfs.rb', line 70

def pop
  color = @stack.pop
  @obj.send(@prop, color) if color.respond_to?(:to_int) or color.respond_to?(:to_str)
end

#push(color) ⇒ Object



65
66
67
68
# File 'lib/epdfs.rb', line 65

def push(color)
  @stack.push @obj.send(@prop)
  @obj.send(@prop, color) if color.respond_to?(:to_int) or color.respond_to?(:to_str)
end