Sha256: 38ce7f9f8f995f2800203a967e3ba7023a2e6c0b7560e6f8748453d6603e88d3

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

#--
# PDF::Writer for Ruby.
#   http://rubyforge.org/projects/ruby-pdf/
#   Copyright 2003 - 2005 Austin Ziegler.
#
#   Licensed under a MIT-style licence. See LICENCE in the main distribution
#   for full licensing information.
#
# $Id$
#++
class PDF::Writer
  class State
    attr_accessor :fill_color
    attr_accessor :stroke_color
    attr_accessor :text_render_style
    attr_accessor :stroke_style

    def initialize(vals = {})
      @fill_color         = vals[:fill_color]
      @stroke_color       = vals[:stroke_color]
      @text_render_style  = vals[:text_render_style]
      @stroke_style       = vals[:stroke_style]

      yield self if block_given?
    end

    def blank?
      @fill_color.nil? and @stroke_color.nil? and @stroke_style.nil?
    end
  end

  class StateStack < ::Array
    alias_method :__push__, :push
#   alias_method :__pop__, :pop

    def push(obj)
      return self if obj.nil?
      raise TypeError unless obj.kind_of?(PDF::Writer::State)
      return self if obj.blank?
      __push__(obj)
    end

#   def pop
#     ret = __pop__
#     ret
#   end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
ypdf-writer-1.3.5 lib/pdf/writer/state.rb
ypdf-writer-1.3.3 lib/pdf/writer/state.rb
ypdf-writer-1.3.2 lib/pdf/writer/state.rb
metaskills-pdf-writer-1.2.2 lib/pdf/writer/state.rb
metaskills-pdf-writer-1.2.3 lib/pdf/writer/state.rb
eventioz-pdf-writer-1.2.4 lib/pdf/writer/state.rb
eventioz-pdf-writer-1.0 lib/pdf/writer/state.rb