rshade 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +0,0 @@
1
- require 'date'
2
- module RShade
3
- class EventSerializer < Base
4
- attr_reader :evt, :level
5
- SERIALIZE_CLASSES = [NilClass, TrueClass, FalseClass, Numeric, Time, Date, String, Symbol, Array]
6
- def initialize(evt, level)
7
- @evt = evt
8
- @level = level
9
- end
10
-
11
- def call
12
- { level: @level, path: evt.path, lineno: evt.lineno, klass: evt.defined_class, method_name: evt.method_id, vars: process_locals(evt) }
13
- end
14
-
15
- def process_locals(evt)
16
- vars = {}
17
- evt.binding.local_variables.each do |var|
18
- local_var = evt.binding.local_variable_get var
19
- if SERIALIZE_CLASSES.any? { |klass| local_var.is_a?(klass) }
20
- vars[var] = local_var
21
- elsif local_var.is_a?(Hash)
22
- vars[var] = shallow_copy_of_hash(local_var)
23
- else
24
- class_name = local_var.is_a?(Class) ? local_var.to_s : local_var.class.to_s
25
- vars[var] = "FILTERED[#{class_name}]"
26
- end
27
- end
28
- vars
29
- end
30
-
31
- #TODO: work on more efficient way to serialize hash
32
- def shallow_copy_of_hash(hash)
33
- {}.tap do |new_hash|
34
- hash.each do |k,v|
35
- new_hash[k] = v.to_s
36
- end
37
- new_hash
38
- end
39
- end
40
- end
41
- end
@@ -1,23 +0,0 @@
1
- module RShade
2
- # nodoc
3
- class EventStore
4
- attr_reader :events
5
-
6
- def initialize
7
- @events = []
8
- end
9
-
10
- def <<(event)
11
- events << event
12
- end
13
-
14
- def iterate(&block)
15
- pos_map = {}
16
- @events.map {|item| item.level }.uniq.sort.each_with_index { |item, index| pos_map[item] = index}
17
- @events.uniq{|item| [item.level, "#{item.klass}##{item.method_name}"]}.sort_by { |item| item.depth }.each do |item|
18
- item.depth = pos_map[item.level]
19
- yield(item, item.depth)
20
- end
21
- end
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- module RShade
2
- module Filter
3
- class AppFilter < ::RShade::Base
4
- attr_reader :data
5
-
6
- def initialize(data)
7
- @data = data
8
- end
9
-
10
- def call
11
- valid?(data[:path])
12
- end
13
-
14
- def valid?(path)
15
- return true if RShade.config.track_gems.any? { |item| path.include? item }
16
- RShade.config.excluded_paths.none? { |item| path.include? item }
17
- end
18
- end
19
- end
20
- end
@@ -1,4 +0,0 @@
1
- module RShade
2
- class Storage
3
- end
4
- end