Class: Crystalball::MapGenerator::AllocatedObjectsStrategy::ObjectTracker
- Inherits:
-
Object
- Object
- Crystalball::MapGenerator::AllocatedObjectsStrategy::ObjectTracker
- Defined in:
- lib/crystalball/map_generator/allocated_objects_strategy/object_tracker.rb
Overview
Class to list object classes used during a block
Instance Attribute Summary collapse
-
#only_of ⇒ Object
readonly
Returns the value of attribute only_of.
Instance Method Summary collapse
-
#initialize(only_of: ['Object']) ⇒ ObjectTracker
constructor
A new instance of ObjectTracker.
-
#used_classes_during { ... } ⇒ Array<Object>
Classes of objects allocated during the block execution.
Constructor Details
#initialize(only_of: ['Object']) ⇒ ObjectTracker
Returns a new instance of ObjectTracker.
13 14 15 16 |
# File 'lib/crystalball/map_generator/allocated_objects_strategy/object_tracker.rb', line 13 def initialize(only_of: ['Object']) @only_of = only_of @created_object_classes = Set.new end |
Instance Attribute Details
#only_of ⇒ Object (readonly)
Returns the value of attribute only_of.
10 11 12 |
# File 'lib/crystalball/map_generator/allocated_objects_strategy/object_tracker.rb', line 10 def only_of @only_of end |
Instance Method Details
#used_classes_during { ... } ⇒ Array<Object>
Returns classes of objects allocated during the block execution.
20 21 22 23 24 |
# File 'lib/crystalball/map_generator/allocated_objects_strategy/object_tracker.rb', line 20 def used_classes_during(&block) self.created_object_classes = Set.new trace_point.enable(&block) created_object_classes end |