Class: TraceTree::Point::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_tree/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*enhancement, config) ⇒ Loader

Returns a new instance of Loader.



191
192
193
194
195
196
# File 'lib/trace_tree/point.rb', line 191

def initialize *enhancement, config
  @config = config
  @bases = Point.bases
  @bases = @bases.map{ |b| b = b.clone; b.prepend *enhancement; b } unless enhancement.empty?
  sort_bases
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



189
190
191
# File 'lib/trace_tree/point.rb', line 189

def config
  @config
end

#point_classesObject (readonly)

Returns the value of attribute point_classes.



189
190
191
# File 'lib/trace_tree/point.rb', line 189

def point_classes
  @point_classes
end

Instance Method Details

#create(point) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/trace_tree/point.rb', line 211

def create point
  point_klass =
    if events = @methods[point.method_id]
      if klasses = events[point.event]
        klasses[point.defined_class] || @common
      else
        @common
      end
    else
      @common
    end

  poi = point_klass.new point
  poi.config = config
  poi
end

#sort_basesObject



198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/trace_tree/point.rb', line 198

def sort_bases
  @methods = {}

  @bases.each do |b|
    event, klass, method = b.event_class_method
    events = (@methods[method] ||= {})
    klasses = (events[event] ||= {})
    klasses[klass] = b
  end

  @common = @methods[nil][:common][nil]
end