Class: Graff
- Inherits:
-
Object
- Object
- Graff
- Defined in:
- lib/graff.rb
Instance Method Summary collapse
-
#active_layer_index ⇒ Object
MAPPINGS.
- #application_version ⇒ Object
- #auto_adjust ⇒ Object
- #background_graphic ⇒ Object
- #base_zoom ⇒ Object
- #canvas_origin ⇒ Object
- #column_align ⇒ Object
- #column_spacing ⇒ Object
- #creation_date ⇒ Object
- #creator ⇒ Object
- #display_scale ⇒ Object
- #graph_document_version ⇒ Object
- #graphics_list ⇒ Object
- #grid_info ⇒ Object
- #guides_locked ⇒ Object
- #guides_visible ⇒ Object
- #h_pages ⇒ Object
- #image_counter ⇒ Object
-
#initialize(file) ⇒ Graff
constructor
A new instance of Graff.
- #keep_to_scale ⇒ Object
- #layers ⇒ Object
- #layout_info ⇒ Object
- #links_visible ⇒ Object
- #magnets_visible ⇒ Object
- #master_sheets ⇒ Object
- #modification_date ⇒ Object
- #modifier ⇒ Object
- #notes_visible ⇒ Object
- #number_of_canvases ⇒ Object
-
#number_of_graphics ⇒ Object
CONVENIENCE METHODS.
- #number_of_layers ⇒ Object
- #orientation ⇒ Object
- #origin_visible ⇒ Object
- #page_breaks ⇒ Object
- #print_info ⇒ Object
- #print_one_page ⇒ Object
- #read_only ⇒ Object
- #row_align ⇒ Object
- #row_spacing ⇒ Object
- #sheet_title ⇒ Object
- #sheets ⇒ Object
- #smart_aligment_guides_active ⇒ Object
- #smart_distance_guides_active ⇒ Object
- #unique_id ⇒ Object
- #use_entire_page ⇒ Object
- #v_pages ⇒ Object
- #version ⇒ Object
- #window_info ⇒ Object
Constructor Details
#initialize(file) ⇒ Graff
Returns a new instance of Graff.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/graff.rb', line 6 def initialize(file) if File.directory?(file) file = file + "/data.plist" end if File.read(file, 2).unpack('CC') == [0x1f, 0x8b] file = Zlib::GzipReader.open(file).read end @stencil = Plist::parse_xml(file) end |
Instance Method Details
#active_layer_index ⇒ Object
MAPPINGS
20 21 22 |
# File 'lib/graff.rb', line 20 def active_layer_index @stencil['ActiveLayerIndex'] end |
#application_version ⇒ Object
24 25 26 |
# File 'lib/graff.rb', line 24 def application_version @stencil['ApplicationVersion'] end |
#auto_adjust ⇒ Object
28 29 30 |
# File 'lib/graff.rb', line 28 def auto_adjust @stencil['AutoAdjust'] end |
#background_graphic ⇒ Object
32 33 34 |
# File 'lib/graff.rb', line 32 def background_graphic @stencil['BackgroundGraphic'] end |
#base_zoom ⇒ Object
36 37 38 |
# File 'lib/graff.rb', line 36 def base_zoom @stencil['BaseZoom'] end |
#canvas_origin ⇒ Object
40 41 42 |
# File 'lib/graff.rb', line 40 def canvas_origin @stencil['CanvasOrigin'] end |
#column_align ⇒ Object
44 45 46 |
# File 'lib/graff.rb', line 44 def column_align @stencil['ColumnAlign'] end |
#column_spacing ⇒ Object
48 49 50 |
# File 'lib/graff.rb', line 48 def column_spacing @stencil['ColumnSpacing'] end |
#creation_date ⇒ Object
52 53 54 |
# File 'lib/graff.rb', line 52 def creation_date @stencil['CreationDate'] end |
#creator ⇒ Object
56 57 58 |
# File 'lib/graff.rb', line 56 def creator @stencil['Creator'] end |
#display_scale ⇒ Object
60 61 62 |
# File 'lib/graff.rb', line 60 def display_scale @stencil['DisplayScale'] end |
#graph_document_version ⇒ Object
64 65 66 |
# File 'lib/graff.rb', line 64 def graph_document_version @stencil['GraphDocumentVersion'] end |
#graphics_list ⇒ Object
68 69 70 |
# File 'lib/graff.rb', line 68 def graphics_list @stencil['GraphicsList'] end |
#grid_info ⇒ Object
72 73 74 |
# File 'lib/graff.rb', line 72 def grid_info @stencil['GridInfo'] end |
#guides_locked ⇒ Object
76 77 78 |
# File 'lib/graff.rb', line 76 def guides_locked @stencil['GuidesLocked'] end |
#guides_visible ⇒ Object
80 81 82 |
# File 'lib/graff.rb', line 80 def guides_visible @stencil['GuidesVisible'] end |
#h_pages ⇒ Object
84 85 86 |
# File 'lib/graff.rb', line 84 def h_pages @stencil['HPages'] end |
#image_counter ⇒ Object
88 89 90 |
# File 'lib/graff.rb', line 88 def image_counter @stencil['ImageCounter'] end |
#keep_to_scale ⇒ Object
92 93 94 |
# File 'lib/graff.rb', line 92 def keep_to_scale @stencil['KeepToScale'] end |
#layers ⇒ Object
96 97 98 |
# File 'lib/graff.rb', line 96 def layers @stencil['Layers'] end |
#layout_info ⇒ Object
100 101 102 |
# File 'lib/graff.rb', line 100 def layout_info @stencil['LayoutInfo'] end |
#links_visible ⇒ Object
104 105 106 |
# File 'lib/graff.rb', line 104 def links_visible @stencil['LinksVisible'] end |
#magnets_visible ⇒ Object
108 109 110 |
# File 'lib/graff.rb', line 108 def magnets_visible @stencil['MagnetsVisible'] end |
#master_sheets ⇒ Object
112 113 114 |
# File 'lib/graff.rb', line 112 def master_sheets @stencil['MasterSheets'] end |
#modification_date ⇒ Object
116 117 118 |
# File 'lib/graff.rb', line 116 def modification_date @stencil['ModificationDate'] end |
#modifier ⇒ Object
120 121 122 |
# File 'lib/graff.rb', line 120 def modifier @stencil['Modifier'] end |
#notes_visible ⇒ Object
124 125 126 |
# File 'lib/graff.rb', line 124 def notes_visible @stencil['NotesVisible'] end |
#number_of_canvases ⇒ Object
210 211 212 |
# File 'lib/graff.rb', line 210 def number_of_canvases self.sheets ? self.sheets.count : 1 end |
#number_of_graphics ⇒ Object
CONVENIENCE METHODS
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/graff.rb', line 198 def number_of_graphics if self.sheets graphics = 0 self.sheets.each do |sheet| graphics = graphics + sheet['GraphicsList'].count end graphics else self.graphics_list.count end end |
#number_of_layers ⇒ Object
214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/graff.rb', line 214 def number_of_layers if self.sheets layers = 0 self.sheets.each do |sheet| layers = layers + sheet['Layers'].count end layers else self.layers ? self.layers.count : 1 end end |
#orientation ⇒ Object
128 129 130 |
# File 'lib/graff.rb', line 128 def orientation @stencil['Orientation'] end |
#origin_visible ⇒ Object
132 133 134 |
# File 'lib/graff.rb', line 132 def origin_visible @stencil['OriginVisible'] end |
#page_breaks ⇒ Object
136 137 138 |
# File 'lib/graff.rb', line 136 def page_breaks @stencil['PageBreaks'] end |
#print_info ⇒ Object
140 141 142 |
# File 'lib/graff.rb', line 140 def print_info @stencil['PrintInfo'] end |
#print_one_page ⇒ Object
144 145 146 |
# File 'lib/graff.rb', line 144 def print_one_page @stencil['PrintOnePage'] end |
#read_only ⇒ Object
148 149 150 |
# File 'lib/graff.rb', line 148 def read_only @stencil['ReadOnly'] end |
#row_align ⇒ Object
152 153 154 |
# File 'lib/graff.rb', line 152 def row_align @stencil['RowAlign'] end |
#row_spacing ⇒ Object
156 157 158 |
# File 'lib/graff.rb', line 156 def row_spacing @stencil['RowSpacing'] end |
#sheet_title ⇒ Object
160 161 162 |
# File 'lib/graff.rb', line 160 def sheet_title @stencil['SheetTitle'] end |
#sheets ⇒ Object
164 165 166 |
# File 'lib/graff.rb', line 164 def sheets @stencil['Sheets'] end |
#smart_aligment_guides_active ⇒ Object
168 169 170 |
# File 'lib/graff.rb', line 168 def smart_aligment_guides_active @stencil['SmartAlignmentGuidesActive'] end |
#smart_distance_guides_active ⇒ Object
172 173 174 |
# File 'lib/graff.rb', line 172 def smart_distance_guides_active @stencil['SmartDistanceGuidesActive'] end |
#unique_id ⇒ Object
176 177 178 |
# File 'lib/graff.rb', line 176 def unique_id @stencil['UniqueID'] end |
#use_entire_page ⇒ Object
184 185 186 |
# File 'lib/graff.rb', line 184 def use_entire_page @stencil['UseEntirePage'] end |
#v_pages ⇒ Object
188 189 190 |
# File 'lib/graff.rb', line 188 def v_pages @stencil['VPages'] end |
#version ⇒ Object
226 227 228 |
# File 'lib/graff.rb', line 226 def version self.graph_document_version end |
#window_info ⇒ Object
192 193 194 |
# File 'lib/graff.rb', line 192 def window_info @stencil['WindowInfo'] end |