Module: Graffle::Sheet

Includes:
Builders, Container
Defined in:
lib/graffle/stereotypes.rb

Overview

A Sheet is what the UI calls a “canvas.” It’s the drawing surface. OmniGraffle Pro lets you have multiple canvases.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Container

#delete_graphic, #find_by_content, #find_by_id, stereotype_children_of, #with

Methods included from Builders

#abstract_graphic, #annotation, classed, #document, #group, #line_graphic, #line_label, raw, #shaped_graphic, #sheet, #text

Class Method Details

.takes_on(hash) ⇒ Object

:nodoc:



477
478
479
480
481
# File 'lib/graffle/stereotypes.rb', line 477

def self.takes_on(hash) # :nodoc: 
  sheet = hash.behave_like(self)
  Container.stereotype_children_of(sheet)
  true
end

Instance Method Details

#all_linesObject

Only the LineGraphic objects within the Sheet.



465
466
467
468
469
# File 'lib/graffle/stereotypes.rb', line 465

def all_lines
  graphics.find_all do | g |
    g.behaves_like?(Graffle::LineGraphic)
  end
end

#first_lineObject

The first LineGraphic within the Sheet. Warning: currently, that does not mean the one highest on the page, so this is really useful only for finding the only line.



475
# File 'lib/graffle/stereotypes.rb', line 475

def first_line; all_lines[0]; end

#graphicsObject

All the visible graphics within the Sheet: objects stereotyped as ShapedGraphic, LineGraphic, or Group.



453
454
455
# File 'lib/graffle/stereotypes.rb', line 453

def graphics
  self['GraphicsList']
end

#graphics_without_labelsObject

Labels for lines are independent ShapedGraphic objects that point to LineGraphic objects, so graphics will return them. This method omits them.



460
461
462
# File 'lib/graffle/stereotypes.rb', line 460

def graphics_without_labels
  graphics.reject { |g| g.is_line_label? }
end