graff 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/graff.rb +221 -0
- metadata +56 -0
data/lib/graff.rb
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'plist'
|
2
|
+
|
3
|
+
class Stencil
|
4
|
+
|
5
|
+
def initialize(file)
|
6
|
+
@stencil = Plist::parse_xml(file)
|
7
|
+
end
|
8
|
+
|
9
|
+
# MAPPINGS
|
10
|
+
|
11
|
+
def active_layer_index
|
12
|
+
@stencil['ActiveLayerIndex']
|
13
|
+
end
|
14
|
+
|
15
|
+
def application_version
|
16
|
+
@stencil['ApplicationVersion']
|
17
|
+
end
|
18
|
+
|
19
|
+
def auto_adjust
|
20
|
+
@stencil['AutoAdjust']
|
21
|
+
end
|
22
|
+
|
23
|
+
def background_graphic
|
24
|
+
@stencil['BackgroundGraphic']
|
25
|
+
end
|
26
|
+
|
27
|
+
def base_zoom
|
28
|
+
@stencil['BaseZoom']
|
29
|
+
end
|
30
|
+
|
31
|
+
def canvas_origin
|
32
|
+
@stencil['CanvasOrigin']
|
33
|
+
end
|
34
|
+
|
35
|
+
def column_align
|
36
|
+
@stencil['ColumnAlign']
|
37
|
+
end
|
38
|
+
|
39
|
+
def column_spacing
|
40
|
+
@stencil['ColumnSpacing']
|
41
|
+
end
|
42
|
+
|
43
|
+
def creation_date
|
44
|
+
@stencil['CreationDate']
|
45
|
+
end
|
46
|
+
|
47
|
+
def creator
|
48
|
+
@stencil['Creator']
|
49
|
+
end
|
50
|
+
|
51
|
+
def display_scale
|
52
|
+
@stencil['DisplayScale']
|
53
|
+
end
|
54
|
+
|
55
|
+
def graph_document_version
|
56
|
+
@stencil['GraphDocumentVersion']
|
57
|
+
end
|
58
|
+
|
59
|
+
def graphics_list
|
60
|
+
@stencil['GraphicsList']
|
61
|
+
end
|
62
|
+
|
63
|
+
def grid_info
|
64
|
+
@stencil['GridInfo']
|
65
|
+
end
|
66
|
+
|
67
|
+
def guides_locked
|
68
|
+
@stencil['GuidesLocked']
|
69
|
+
end
|
70
|
+
|
71
|
+
def guides_visible
|
72
|
+
@stencil['GuidesVisible']
|
73
|
+
end
|
74
|
+
|
75
|
+
def h_pages
|
76
|
+
@stencil['HPages']
|
77
|
+
end
|
78
|
+
|
79
|
+
def image_counter
|
80
|
+
@stencil['ImageCounter']
|
81
|
+
end
|
82
|
+
|
83
|
+
def keep_to_scale
|
84
|
+
@stencil['KeepToScale']
|
85
|
+
end
|
86
|
+
|
87
|
+
def layers
|
88
|
+
@stencil['Layers']
|
89
|
+
end
|
90
|
+
|
91
|
+
def layout_info
|
92
|
+
@stencil['LayoutInfo']
|
93
|
+
end
|
94
|
+
|
95
|
+
def links_visible
|
96
|
+
@stencil['LinksVisible']
|
97
|
+
end
|
98
|
+
|
99
|
+
def magnets_visible
|
100
|
+
@stencil['MagnetsVisible']
|
101
|
+
end
|
102
|
+
|
103
|
+
def master_sheets
|
104
|
+
@stencil['MasterSheets']
|
105
|
+
end
|
106
|
+
|
107
|
+
def modification_date
|
108
|
+
@stencil['ModificationDate']
|
109
|
+
end
|
110
|
+
|
111
|
+
def modifier
|
112
|
+
@stencil['Modifier']
|
113
|
+
end
|
114
|
+
|
115
|
+
def notes_visible
|
116
|
+
@stencil['NotesVisible']
|
117
|
+
end
|
118
|
+
|
119
|
+
def orientation
|
120
|
+
@stencil['Orientation']
|
121
|
+
end
|
122
|
+
|
123
|
+
def origin_visible
|
124
|
+
@stencil['OriginVisible']
|
125
|
+
end
|
126
|
+
|
127
|
+
def page_breaks
|
128
|
+
@stencil['PageBreaks']
|
129
|
+
end
|
130
|
+
|
131
|
+
def print_info
|
132
|
+
@stencil['PrintInfo']
|
133
|
+
end
|
134
|
+
|
135
|
+
def print_one_page
|
136
|
+
@stencil['PrintOnePage']
|
137
|
+
end
|
138
|
+
|
139
|
+
def read_only
|
140
|
+
@stencil['ReadOnly']
|
141
|
+
end
|
142
|
+
|
143
|
+
def row_align
|
144
|
+
@stencil['RowAlign']
|
145
|
+
end
|
146
|
+
|
147
|
+
def row_spacing
|
148
|
+
@stencil['RowSpacing']
|
149
|
+
end
|
150
|
+
|
151
|
+
def sheet_title
|
152
|
+
@stencil['SheetTitle']
|
153
|
+
end
|
154
|
+
|
155
|
+
def sheets
|
156
|
+
@stencil['Sheets']
|
157
|
+
end
|
158
|
+
|
159
|
+
def smart_aligment_guides_active
|
160
|
+
@stencil['SmartAlignmentGuidesActive']
|
161
|
+
end
|
162
|
+
|
163
|
+
def smart_distance_guides_active
|
164
|
+
@stencil['SmartDistanceGuidesActive']
|
165
|
+
end
|
166
|
+
|
167
|
+
def unique_id
|
168
|
+
@stencil['UniqueID']
|
169
|
+
end
|
170
|
+
|
171
|
+
def unique_id
|
172
|
+
@stencil['UniqueID']
|
173
|
+
end
|
174
|
+
|
175
|
+
def use_entire_page
|
176
|
+
@stencil['UseEntirePage']
|
177
|
+
end
|
178
|
+
|
179
|
+
def v_pages
|
180
|
+
@stencil['VPages']
|
181
|
+
end
|
182
|
+
|
183
|
+
def window_info
|
184
|
+
@stencil['WindowInfo']
|
185
|
+
end
|
186
|
+
|
187
|
+
# CONVENIENCE METHODS
|
188
|
+
|
189
|
+
def number_of_graphics
|
190
|
+
if self.sheets
|
191
|
+
graphics = 0
|
192
|
+
self.sheets.each do |sheet|
|
193
|
+
graphics = graphics + sheet['GraphicsList'].count
|
194
|
+
end
|
195
|
+
graphics
|
196
|
+
else
|
197
|
+
self.graphics_list.count
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def number_of_canvases
|
202
|
+
self.sheets ? self.sheets.count : 1
|
203
|
+
end
|
204
|
+
|
205
|
+
def number_of_layers
|
206
|
+
if self.sheets
|
207
|
+
layers = 0
|
208
|
+
self.sheets.each do |sheet|
|
209
|
+
layers = layers + sheet['Layers'].count
|
210
|
+
end
|
211
|
+
layers
|
212
|
+
else
|
213
|
+
self.layers.count || 0
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def version
|
218
|
+
self.graph_document_version
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: graff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Patrick Crowley
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-12 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: plist
|
16
|
+
requirement: &70167979108340 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70167979108340
|
25
|
+
description: Parse OmniGraffle documents
|
26
|
+
email: patrick@mokolabs.com
|
27
|
+
executables: []
|
28
|
+
extensions: []
|
29
|
+
extra_rdoc_files: []
|
30
|
+
files:
|
31
|
+
- lib/graff.rb
|
32
|
+
homepage: http://rubygems.org/gems/graff
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.10
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: graff
|
56
|
+
test_files: []
|