Class: RGhost::VerticalLine

Inherits:
PsObject show all
Defined in:
lib/rghost/vertical_line.rb

Overview

Creates vertical line starting from current row.

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :start_in=>:limit_left,:size=>:area_y,
  :border => RGhost::Border::DEFAULT_OPTIONS
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PsObject

#<<, #call, #graphic_scope, #ps, #raw, #set, #to_s

Constructor Details

#initialize(options = RGhost::Border::DEFAULT_OPTIONS) ⇒ VerticalLine

Draws a vertical line where :start_in => y position and :size => size of line.

Example

doc=Document.new doc.vertical_line :start_in => 1, :size => 2, :border => => :red


15
16
17
18
19
20
21
22
23
24
# File 'lib/rghost/vertical_line.rb', line 15

def initialize(options=RGhost::Border::DEFAULT_OPTIONS)
  super(""){}
  options=DEFAULT_OPTIONS.dup.merge(options)
  start_in= RGhost::Units::parse(options[:start_in] || :limit_left)
  size= RGhost::Units::parse(options[:size]|| :area_y)
  g=RGhost::Graphic.new
  g.set RGhost::Border.new(options[:border]) if options[:border]
  g.raw "#{start_in} #{size} vertical_line "
  set g
end

Class Method Details

.row(border = RGhost::Border::DEFAULT_OPTIONS) ⇒ Object

Draws a vertical line with size or :row_height of the document.

doc=Document.new
doc.vertical_line_row

28
29
30
31
32
33
34
# File 'lib/rghost/vertical_line.rb', line 28

def self.row(border=RGhost::Border::DEFAULT_OPTIONS)
  
  g=RGhost::Graphic.new
  g.set RGhost::Border.new(border)
  g.raw :vlrf
  g
end