sketchup-api-stubs 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/SketchUp/{array.rb → Array.rb} +0 -0
  3. data/SketchUp/{geom.rb → Geom.rb} +0 -0
  4. data/SketchUp/Geom/LatLong.rb +8 -20
  5. data/SketchUp/Geom/Point3d.rb +2 -2
  6. data/SketchUp/Geom/Vector3d.rb +31 -26
  7. data/SketchUp/{languagehandler.rb → LanguageHandler.rb} +0 -0
  8. data/SketchUp/{length.rb → Length.rb} +0 -0
  9. data/SketchUp/{numeric.rb → Numeric.rb} +0 -0
  10. data/SketchUp/Sketchup/AttributeDictionaries.rb +8 -11
  11. data/SketchUp/Sketchup/AttributeDictionary.rb +39 -38
  12. data/SketchUp/Sketchup/Classifications.rb +9 -5
  13. data/SketchUp/Sketchup/DefinitionList.rb +9 -12
  14. data/SketchUp/Sketchup/Entities.rb +16 -36
  15. data/SketchUp/Sketchup/ExtensionsManager.rb +10 -14
  16. data/SketchUp/Sketchup/InstancePath.rb +6 -3
  17. data/SketchUp/Sketchup/Layers.rb +20 -24
  18. data/SketchUp/Sketchup/Licensing.rb +14 -13
  19. data/SketchUp/Sketchup/Materials.rb +10 -8
  20. data/SketchUp/Sketchup/Menu.rb +13 -15
  21. data/SketchUp/Sketchup/OptionsManager.rb +11 -14
  22. data/SketchUp/Sketchup/OptionsProvider.rb +55 -54
  23. data/SketchUp/Sketchup/Pages.rb +9 -9
  24. data/SketchUp/Sketchup/RenderingOptions.rb +27 -15
  25. data/SketchUp/Sketchup/Selection.rb +57 -89
  26. data/SketchUp/Sketchup/Set.rb +69 -104
  27. data/SketchUp/Sketchup/ShadowInfo.rb +26 -26
  28. data/SketchUp/Sketchup/Styles.rb +8 -9
  29. data/SketchUp/{sketchupextension.rb → SketchupExtension.rb} +0 -0
  30. data/SketchUp/{string.rb → String.rb} +0 -0
  31. data/SketchUp/UI/Toolbar.rb +8 -8
  32. data/SketchUp/_top_level.rb +11 -11
  33. data/SketchUp/ui.rb +4 -5
  34. metadata +10 -10
@@ -80,8 +80,7 @@ class Sketchup::OptionsProvider
80
80
  # +Enumable+ mix-in module. Prior to that the {#count} method is an alias
81
81
  # for {#length}.
82
82
  #
83
- # @return integer - the size of the options provider if
84
- # successful
83
+ # @return [Integer]
85
84
  #
86
85
  # @see #length
87
86
  #
@@ -89,60 +88,60 @@ class Sketchup::OptionsProvider
89
88
  def count
90
89
  end
91
90
 
92
- # The each method is used to iterate through all of the attributes.
93
- #
94
- # Throws an exception if there are no keys.
95
- #
96
- # The {#each_pair} method is an alias of {#each}.
91
+ # The {#each} method is used to iterate through all of the options.
97
92
  #
98
93
  # @example
99
- # # Retrieves each key
100
- # provider.each { |key, value| UI.messagebox key }
101
- # # Retrieves each corresponding value
102
- # provider.each { |key, value| UI.messagebox value }
94
+ # model = Sketchup.active_model.options
95
+ # provider = model.options['UnitsOptions']
96
+ # provider.each { |key, value| puts "#{key} = #{value}" }
103
97
  #
104
- # @return nil
98
+ # @return [nil]
99
+ #
100
+ # @see #each_key
105
101
  #
106
102
  # @version SketchUp 6.0
107
103
  #
108
- # @yield [key, value] Variables that will hold each key and value as they are
109
- # found.
104
+ # @yield [key, value]
105
+ #
106
+ # @yieldparam [Object] value
107
+ #
108
+ # @yieldparam [String] key
110
109
  def each
111
110
  end
112
111
 
113
- # The each_key method is used to iterate through all of the attribute keys.
114
- #
115
- # Throws an exception if there are no keys.
112
+ # The {#each_key} method is used to iterate through all of the attribute keys.
116
113
  #
117
114
  # @example
118
115
  # provider.each_key { |key| UI.messagebox key }
119
116
  #
120
- # @return nil
117
+ # @return [nil]
121
118
  #
122
119
  # @version SketchUp 6.0
123
120
  #
124
- # @yield [key] A variable that will hold each key as they are found.
121
+ # @yield [key]
122
+ #
123
+ # @yieldparam [String] key
125
124
  def each_key
126
125
  end
127
126
 
128
- # The each method is used to iterate through all of the attributes.
129
- #
130
- # Throws an exception if there are no keys.
131
- #
132
- # The {#each_pair} method is an alias of {#each}.
127
+ # The {#each} method is used to iterate through all of the options.
133
128
  #
134
129
  # @example
135
- # # Retrieves each key
136
- # provider.each { |key, value| UI.messagebox key }
137
- # # Retrieves each corresponding value
138
- # provider.each { |key, value| UI.messagebox value }
130
+ # model = Sketchup.active_model.options
131
+ # provider = model.options['UnitsOptions']
132
+ # provider.each { |key, value| puts "#{key} = #{value}" }
139
133
  #
140
- # @return nil
134
+ # @return [nil]
135
+ #
136
+ # @see #each_key
141
137
  #
142
138
  # @version SketchUp 6.0
143
139
  #
144
- # @yield [key, value] Variables that will hold each key and value as they are
145
- # found.
140
+ # @yield [key, value]
141
+ #
142
+ # @yieldparam [Object] value
143
+ #
144
+ # @yieldparam [String] key
146
145
  def each_pair
147
146
  end
148
147
 
@@ -162,38 +161,43 @@ class Sketchup::OptionsProvider
162
161
  def each_value
163
162
  end
164
163
 
165
- # The key? method is used to determine if the options provider has a specific
166
- # key. This method is the same as has_key? See also OptionsManager.has_key
164
+ # The {#has_key?} method is an alias for {#key?}.
167
165
  #
168
166
  # @example
169
- # status = provider.key? "name"
167
+ # model = Sketchup.active_model.options
168
+ # provider = model.options['UnitsOptions']
169
+ # p provider.has_key?("LengthFormat")
170
170
  #
171
- # @param name
171
+ # @param [String] name
172
172
  # The name of the key you are looking for.
173
173
  #
174
- # @return status - true if the key exists, false if the key does
175
- # not exist.
174
+ # @return [Boolean]
176
175
  #
177
176
  # @return [Boolean]
178
177
  #
178
+ # @see #key?
179
+ #
179
180
  # @version SketchUp 6.0
180
181
  def has_key?(name)
181
182
  end
182
183
 
183
- # The key? method is used to determine if the options provider has a specific
184
- # key. This method is the same as has_key? See also OptionsManager.has_key
184
+ # The {#key?} method is used to determine if the options provider has a
185
+ # specific key.
185
186
  #
186
187
  # @example
187
- # status = provider.key? "name"
188
+ # model = Sketchup.active_model.options
189
+ # provider = model.options['UnitsOptions']
190
+ # p provider.key?("LengthFormat")
188
191
  #
189
- # @param name
192
+ # @param [String] name
190
193
  # The name of the key you are looking for.
191
194
  #
192
- # @return status - true if the key exists, false if the key does
193
- # not exist.
195
+ # @return [Boolean]
194
196
  #
195
197
  # @return [Boolean]
196
198
  #
199
+ # @see #has_key?
200
+ #
197
201
  # @version SketchUp 6.0
198
202
  def key?(name)
199
203
  end
@@ -216,19 +220,17 @@ class Sketchup::OptionsProvider
216
220
  def keys
217
221
  end
218
222
 
219
- # The {#size} method is used to retrieve the size (number of elements) of an
220
- # options provider.
221
- #
222
223
  # The {#length} method is an alias of {#size}.
223
224
  #
224
225
  # @example
225
226
  # optionsprovider = Sketchup.active_model.options['UnitsOptions']
226
- # number = optionsprovider.size
227
+ # number = optionsprovider.length
227
228
  #
228
- # @return integer - the size of the options provider if
229
- # successful
229
+ # @return [Integer]
230
230
  #
231
- # @version SketchUp 6.0
231
+ # @see #size
232
+ #
233
+ # @version SketchUp 2014
232
234
  def length
233
235
  end
234
236
 
@@ -261,14 +263,13 @@ class Sketchup::OptionsProvider
261
263
  # The {#size} method is used to retrieve the size (number of elements) of an
262
264
  # options provider.
263
265
  #
264
- # The {#length} method is an alias of {#size}.
265
- #
266
266
  # @example
267
267
  # optionsprovider = Sketchup.active_model.options['UnitsOptions']
268
268
  # number = optionsprovider.size
269
269
  #
270
- # @return integer - the size of the options provider if
271
- # successful
270
+ # @return [Integer]
271
+ #
272
+ # @see #length
272
273
  #
273
274
  # @version SketchUp 6.0
274
275
  def size
@@ -176,7 +176,7 @@ class Sketchup::Pages < Sketchup::Entity
176
176
  # +Enumable+ mix-in module. Prior to that the {#count} method is an alias
177
177
  # for {#length}.
178
178
  #
179
- # @return integer - the number of pages if successful
179
+ # @return [Integer]
180
180
  #
181
181
  # @see #length
182
182
  #
@@ -216,19 +216,19 @@ class Sketchup::Pages < Sketchup::Entity
216
216
  def erase(page)
217
217
  end
218
218
 
219
- # The {#size} method is used to retrieve the number of pages.
220
- #
221
219
  # The {#length} method is an alias for {#size}.
222
220
  #
223
221
  # @example
224
222
  # pages = Sketchup.active_model.pages
225
223
  # pages.add('Page 1')
226
224
  # pages.add('Page 2')
227
- # number = pages.size
225
+ # number = pages.length
228
226
  #
229
- # @return integer - the number of pages if successful
227
+ # @return [Integer]
230
228
  #
231
- # @version SketchUp 6.0
229
+ # @see #size
230
+ #
231
+ # @version SketchUp 2014
232
232
  def length
233
233
  end
234
234
 
@@ -318,15 +318,15 @@ class Sketchup::Pages < Sketchup::Entity
318
318
 
319
319
  # The {#size} method is used to retrieve the number of pages.
320
320
  #
321
- # The {#length} method is an alias for {#size}.
322
- #
323
321
  # @example
324
322
  # pages = Sketchup.active_model.pages
325
323
  # pages.add('Page 1')
326
324
  # pages.add('Page 2')
327
325
  # number = pages.size
328
326
  #
329
- # @return integer - the number of pages if successful
327
+ # @return [Integer]
328
+ #
329
+ # @see #length
330
330
  #
331
331
  # @version SketchUp 6.0
332
332
  def size
@@ -228,22 +228,33 @@ class Sketchup::RenderingOptions < Sketchup::Entity
228
228
  # options = Sketchup.active_model.rendering_options
229
229
  # number = options.count
230
230
  #
231
- # @return integer
231
+ # @return [Integer]
232
232
  #
233
233
  # @version SketchUp 2014
234
234
  def count
235
235
  end
236
236
 
237
- # An alias for each. See RenderingOptions.each.
237
+ # The {#each} method iterates through all of the rendering options key/value
238
+ # pairs.
238
239
  #
239
240
  # @example
240
- # Sketchup.active_model.rendering_options.each_pair { |key, value|
241
+ # Sketchup.active_model.rendering_options.each { |key, value|
241
242
  # puts "#{key} : #{value}"
242
243
  # }
243
244
  #
244
- # @return nil
245
+ # @return [nil]
246
+ #
247
+ # @see #each_pair
245
248
  #
246
249
  # @version SketchUp 6.0
250
+ #
251
+ # @yield [key, value]
252
+ #
253
+ # @yieldparam [Object] value
254
+ # The value of each pair found.
255
+ #
256
+ # @yieldparam [String] key
257
+ # The key of each pair found.
247
258
  def each
248
259
  end
249
260
 
@@ -262,14 +273,16 @@ class Sketchup::RenderingOptions < Sketchup::Entity
262
273
  def each_key
263
274
  end
264
275
 
265
- # An alias for each. See RenderingOptions.each.
276
+ # The {#each_pair} method is an alias for {#each}.
266
277
  #
267
278
  # @example
268
279
  # Sketchup.active_model.rendering_options.each_pair { |key, value|
269
280
  # puts "#{key} : #{value}"
270
281
  # }
271
282
  #
272
- # @return nil
283
+ # @return [nil]
284
+ #
285
+ # @see #each
273
286
  #
274
287
  # @version SketchUp 6.0
275
288
  def each_pair
@@ -287,15 +300,15 @@ class Sketchup::RenderingOptions < Sketchup::Entity
287
300
  end
288
301
 
289
302
  # The {#length} method returns the number of options in the rendering options
290
- # collection
291
- #
292
- # The {#size} method is an alias for {#length}.
303
+ # collection.
293
304
  #
294
305
  # @example
295
306
  # options = Sketchup.active_model.rendering_options
296
307
  # number = options.length
297
308
  #
298
- # @return integer
309
+ # @return [Integer]
310
+ #
311
+ # @see #size
299
312
  #
300
313
  # @version SketchUp 2014
301
314
  def length
@@ -319,16 +332,15 @@ class Sketchup::RenderingOptions < Sketchup::Entity
319
332
  def remove_observer(observer)
320
333
  end
321
334
 
322
- # The {#length} method returns the number of options in the rendering options
323
- # collection
324
- #
325
335
  # The {#size} method is an alias for {#length}.
326
336
  #
327
337
  # @example
328
338
  # options = Sketchup.active_model.rendering_options
329
- # number = options.length
339
+ # number = options.size
340
+ #
341
+ # @return [Integer]
330
342
  #
331
- # @return integer
343
+ # @see #length
332
344
  #
333
345
  # @version SketchUp 2014
334
346
  def size
@@ -21,39 +21,26 @@ class Sketchup::Selection
21
21
 
22
22
  # Instance Methods
23
23
 
24
- # The [] method is used to retrieve an Entity object from the selection by
25
- # index. Index 0 is the first entity in the selection.
24
+ # The {#[]} method is used to retrieve an {Sketchup::Entity} from the selection
25
+ # by index. Index 0 is the first entity in the selection.
26
26
  #
27
27
  # This method is not very efficient. If you need to look at every entity in
28
- # the selection, consider using Selection.each instead of using this method
28
+ # the selection, consider using {#each} instead of using this method
29
29
  # to manually grab each one.
30
30
  #
31
31
  # @example
32
- # depth = 100
33
- # width = 100
34
32
  # model = Sketchup.active_model
35
33
  # entities = model.active_entities
36
- # pts = []
37
- # pts[0] = [0, 0, 0]
38
- # pts[1] = [width, 0, 0]
39
- # pts[2] = [width, depth, 0]
40
- # pts[3] = [0, depth, 0]
41
- # # Add the face to the entities in the model
42
- # face = entities.add_face pts
43
34
  # selection = model.selection
44
- # entity = entities[0]
45
- # status = selection.add entity
46
- # entity = selection[0]
47
- # if (entity)
48
- # UI.messagebox entity
49
- # else
50
- # UI.messagebox "Failure"
51
- # end
52
- #
53
- # @param index
35
+ # selection.add(entities.to_a)
36
+ # p selection[0]
37
+ #
38
+ # @param [Integer] index
54
39
  # The index of the Entity object to retrieve.
55
40
  #
56
- # @return entity - an Entity object if successful
41
+ # @return [Sketchup::Entitiy, nil]
42
+ #
43
+ # @see #at
57
44
  #
58
45
  # @version SketchUp 6.0
59
46
  def [](index)
@@ -104,39 +91,21 @@ class Sketchup::Selection
104
91
  def add_observer(observer)
105
92
  end
106
93
 
107
- # The [] method is used to retrieve an Entity object from the selection by
108
- # index. Index 0 is the first entity in the selection.
109
- #
110
- # This method is not very efficient. If you need to look at every entity in
111
- # the selection, consider using Selection.each instead of using this method
112
- # to manually grab each one.
94
+ # The {#at} method is an alias for {#[]}.
113
95
  #
114
96
  # @example
115
- # depth = 100
116
- # width = 100
117
97
  # model = Sketchup.active_model
118
98
  # entities = model.active_entities
119
- # pts = []
120
- # pts[0] = [0, 0, 0]
121
- # pts[1] = [width, 0, 0]
122
- # pts[2] = [width, depth, 0]
123
- # pts[3] = [0, depth, 0]
124
- # # Add the face to the entities in the model
125
- # face = entities.add_face pts
126
99
  # selection = model.selection
127
- # entity = entities[0]
128
- # status = selection.add entity
129
- # entity = selection[0]
130
- # if (entity)
131
- # UI.messagebox entity
132
- # else
133
- # UI.messagebox "Failure"
134
- # end
135
- #
136
- # @param index
100
+ # selection.add(entities.to_a)
101
+ # p selection.at(0)
102
+ #
103
+ # @param [Integer] index
137
104
  # The index of the Entity object to retrieve.
138
105
  #
139
- # @return entity - an Entity object if successful
106
+ # @return [Sketchup::Entitiy, nil]
107
+ #
108
+ # @see #[]
140
109
  #
141
110
  # @version SketchUp 6.0
142
111
  def at(index)
@@ -156,20 +125,23 @@ class Sketchup::Selection
156
125
  def clear
157
126
  end
158
127
 
159
- # The include? method is an alias for contains
128
+ # The {contains?} method is and alias of {#include?}.
160
129
  #
161
130
  # @example
162
- # selection.add entity
163
- # status = selection.include? entity
131
+ # model = Sketchup.active_model
132
+ # entity = model.active_entities.first
133
+ # selection = model.selection
134
+ # selection.add(entity)
135
+ # p selection.contains?(entity)
164
136
  #
165
- # @param entity
166
- # An Entity object.
137
+ # @param [Sketchup::Entity] entity
167
138
  #
168
- # @return status - true if the Entity object is in the selection.
169
- # False if the Entity object is not in the selection.
139
+ # @return [Boolean]
170
140
  #
171
141
  # @return [Boolean]
172
142
  #
143
+ # @see #include?
144
+ #
173
145
  # @version SketchUp 6.0
174
146
  def contains?(entity)
175
147
  end
@@ -183,8 +155,7 @@ class Sketchup::Selection
183
155
  # +Enumable+ mix-in module. Prior to that the {#count} method is an alias
184
156
  # for {#length}.
185
157
  #
186
- # @return integer - the number of Entities in the selection if
187
- # successful
158
+ # @return [Integer]
188
159
  #
189
160
  # @see #length
190
161
  #
@@ -241,20 +212,24 @@ class Sketchup::Selection
241
212
  def first
242
213
  end
243
214
 
244
- # The include? method is an alias for contains
215
+ # The {include?} method is used to determine if a given {Sketchup::Entity} is
216
+ # in the selection.
245
217
  #
246
218
  # @example
247
- # selection.add entity
248
- # status = selection.include? entity
219
+ # model = Sketchup.active_model
220
+ # entity = model.active_entities.first
221
+ # selection = model.selection
222
+ # selection.add(entity)
223
+ # p selection.include?(entity)
249
224
  #
250
- # @param entity
251
- # An Entity object.
225
+ # @param [Sketchup::Entity] entity
252
226
  #
253
- # @return status - true if the Entity object is in the selection.
254
- # False if the Entity object is not in the selection.
227
+ # @return [Boolean]
255
228
  #
256
229
  # @return [Boolean]
257
230
  #
231
+ # @see #contains?
232
+ #
258
233
  # @version SketchUp 6.0
259
234
  def include?(entity)
260
235
  end
@@ -294,18 +269,17 @@ class Sketchup::Selection
294
269
  def is_surface?
295
270
  end
296
271
 
297
- # The {#length} method is used to retrieve the number of selected Entities.
298
- #
299
- # The {#nitems} methods is an alias of {#length}.
300
- #
301
- # The {#size} methods is an alias of {#length} added in SketchUp 2014.
272
+ # The {#length} method is used to retrieve the number of selected entities.
302
273
  #
303
274
  # @example
304
275
  # selection = Sketchup.active_model.selection
305
276
  # number = selection.length
306
277
  #
307
- # @return integer - the number of entities in the selection if
308
- # successful
278
+ # @return [Integer]
279
+ #
280
+ # @see #nitems
281
+ #
282
+ # @see #size
309
283
  #
310
284
  # @version SketchUp 6.0
311
285
  def length
@@ -323,18 +297,15 @@ class Sketchup::Selection
323
297
  def model
324
298
  end
325
299
 
326
- # The {#length} method is used to retrieve the number of selected Entities.
327
- #
328
- # The {#nitems} methods is an alias of {#length}.
329
- #
330
- # The {#size} methods is an alias of {#length} added in SketchUp 2014.
300
+ # The {#nitems} method is an alias for {#length}.
331
301
  #
332
302
  # @example
333
303
  # selection = Sketchup.active_model.selection
334
- # number = selection.length
304
+ # number = selection.nitems
335
305
  #
336
- # @return integer - the number of entities in the selection if
337
- # successful
306
+ # @return [Integer]
307
+ #
308
+ # @see #length
338
309
  #
339
310
  # @version SketchUp 6.0
340
311
  def nitems
@@ -419,20 +390,17 @@ class Sketchup::Selection
419
390
  def single_object?
420
391
  end
421
392
 
422
- # The {#length} method is used to retrieve the number of selected Entities.
423
- #
424
- # The {#nitems} methods is an alias of {#length}.
425
- #
426
- # The {#size} methods is an alias of {#length} added in SketchUp 2014.
393
+ # The {#size} method is an alias for {#length}.
427
394
  #
428
395
  # @example
429
396
  # selection = Sketchup.active_model.selection
430
- # number = selection.length
397
+ # number = selection.size
431
398
  #
432
- # @return integer - the number of entities in the selection if
433
- # successful
399
+ # @return [Integer]
434
400
  #
435
- # @version SketchUp 6.0
401
+ # @see #length
402
+ #
403
+ # @version SketchUp 2014
436
404
  def size
437
405
  end
438
406