Which can lead to some other obvious questions.
Some of following comes from a gem I have been working on to extend Ruby’s type/class introspection.
What are the unique instance methods that the Group class defines ?
only_defined_methods = Sketchup::Group.instance_methods(false).sort
puts only_defined_methods
>>
add_observer
copy
definition
description
description=
entities
equals?
explode
guid
intersect
local_bounds
locked=
locked?
make_unique
manifold?
move!
name
name=
outer_shell
remove_observer
show_differences
split
subtract
to_component
transform!
transformation
transformation=
trim
union
volume
What are the instance methods that the Group class inherits from all it’s ancestor classes ?
all_instance_methods = Sketchup::Group.instance_methods(true).sort
only_defined_methods = Sketchup::Group.instance_methods(false).sort
all_inherited_methods = all_instance_methods - only_defined_methods
puts all_inherited_methods
The listing is too long to post. (Do it as an exercise in the Ruby Console, if you want to see it.)
What are the instance methods that the Group class inherits from it’s direct parent class ?
only_defined_methods = Sketchup::Group.instance_methods(false).sort
super_all_instance_methods = Sketchup::Group.superclass.instance_methods(true).sort
super_only_defined_methods = Sketchup::Group.superclass.instance_methods(false).sort
# if any of super_only_defined_methods are present in only_defined_methods,
# then they have been specifically overridden in Sketchup::Group, and not inherited.
not_overridden_super_inherited_methods = super_only_defined_methods - only_defined_methods
puts "#{Sketchup::Group.name}'s superclass: "<<Sketchup::Group.superclass.name
puts not_overridden_super_inherited_methods
>>
bounds
casts_shadows=
casts_shadows?
erase!
hidden=
hidden?
last_scaling_factors
layer
layer=
local_transformation
material
material=
receives_shadows=
receives_shadows?
scaled_size
set_last_size
unscaled_size
visible=
visible?
The methods not listed in the API Dictionary are added by the Dynamic Components extension.
To remove them from a listing, with Ruby 2.x:
de = Sketchup::Group.superclass.new
# native API methods defined in C return nil for source_location
result = not_overridden_super_inherited_methods.find_all{|m|
de.method(m).source_location.nil?
}
de = nil
puts result
>>
bounds
casts_shadows=
casts_shadows?
erase!
hidden=
hidden?
layer
layer=
material
material=
receives_shadows=
receives_shadows?
visible=
visible?