### Home Classes Methods

### In Files

- lib/prawn/document/graphics_state.rb

### Parent

Object

### Methods

- ::new
- #current_state
- #empty?
- #present?
- #restore_graphic_state
- #save_graphic_state

### Files

- COPYING
- GPLv2
- GPLv3
- LICENSE

### Class/Module Index

Quicksearch

- Prawn
- Prawn::Core
- Prawn::Core::Page
- Prawn::Core::Page::GraphicsState
- Prawn::Core::Reference
- Prawn::Document
- Prawn::Document::BoundingBox
- Prawn::Document::ColumnBox
- Prawn::Document::GraphicsState
- Prawn::Document::Grid
- Prawn::Document::Internals
- Prawn::Document::PageGeometry
- Prawn::Document::Security
- Prawn::Document::Snapshot
- Prawn::Encoding
- Prawn::Errors
- Prawn::Font
- Prawn::Font::AFM
- Prawn::Font::DFont
- Prawn::Font::TTF
- Prawn::GraphicState
- Prawn::GraphicStateStack
- Prawn::Graphics
- Prawn::Graphics::CapStyle
- Prawn::Graphics::Color
- Prawn::Graphics::Dash
- Prawn::Graphics::Gradient
- Prawn::Graphics::JoinStyle
- Prawn::Graphics::Transformation
- Prawn::Graphics::Transparency
- Prawn::Images
- Prawn::Images::JPG
- Prawn::Images::PNG
- Prawn::Layout
- Prawn::Measurements
- Prawn::Outline
- Prawn::Stamp
- Prawn::Table
- Prawn::Table::Cell
- Prawn::Table::Cell::InTable
- Prawn::Table::Cell::Subtable
- Prawn::Table::Cell::Text
- Prawn::Table::Cells
- Prawn::Text
- Prawn::Text::Box
- Prawn::Text::Formatted
- Prawn::Text::Formatted::Box
- Prawn::Text::Formatted::Fragment
- Prawn::Text::Formatted::Parser
- Arcfour
- Numeric

No matching classes.

# Prawn::GraphicStateStack

### Attributes

stack[RW]

### Public Class Methods

new(previous_state = nil) click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 13
    def initialize(previous_state = nil)
      self.stack = [GraphicState.new(previous_state)]
    end

### Public Instance Methods

current_state() click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 29
    def current_state
      stack.last
    end

empty?() click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 37
    def empty?
      stack.empty?
    end

present?() click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 33
    def present?
      stack.size > 0
    end

restore_graphic_state() click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 21
    def restore_graphic_state
      if stack.empty?
        raise Prawn::Errors::EmptyGraphicStateStack,
          "\n You have reached the end of the graphic state stack"
      end
      stack.pop
    end

save_graphic_state(graphic_state = nil) click to toggle source

    # File lib/prawn/document/graphics_state.rb, line 17
    def save_graphic_state(graphic_state = nil)
      stack.push(GraphicState.new(graphic_state || current_state))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.