gestalt 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/gestalt.gemspec +2 -2
  2. data/lib/gestalt.rb +14 -17
  3. metadata +3 -3
data/gestalt.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'gestalt'
16
- s.version = '0.0.2'
17
- s.date = '2010-04-26'
16
+ s.version = '0.0.3'
17
+ s.date = '2010-04-29'
18
18
  s.rubyforge_project = 'gestalt'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
data/lib/gestalt.rb CHANGED
@@ -5,18 +5,19 @@ require 'formatador'
5
5
 
6
6
  class Gestalt
7
7
 
8
- VERSION = '0.0.2'
8
+ VERSION = '0.0.3'
9
9
 
10
- attr_accessor :calls, :formatador
10
+ attr_accessor :calls
11
11
 
12
- def initialize
12
+ def initialize(formatador = Formatador.new)
13
13
  @calls = []
14
+ @formatador = Formatador.new
14
15
  @stack = []
15
16
  @totals = {}
16
17
  end
17
18
 
18
19
  def display_calls
19
- formatador.display_line
20
+ @formatador.display_line
20
21
  condensed = []
21
22
  total = 0.0
22
23
  for call in @calls
@@ -28,9 +29,9 @@ class Gestalt
28
29
  total += call.duration
29
30
  end
30
31
  for call in condensed
31
- call.display(total, formatador)
32
+ call.display(total, @formatador)
32
33
  end
33
- formatador.display_line
34
+ @formatador.display_line
34
35
  end
35
36
 
36
37
  def display_profile
@@ -47,13 +48,9 @@ class Gestalt
47
48
  end
48
49
  table = table.sort {|x,y| y[:duration] <=> x[:duration]}
49
50
 
50
- formatador.display_line
51
- formatador.display_table(table)
52
- formatador.display_line
53
- end
54
-
55
- def formatador
56
- @formatador ||= Formatador.new
51
+ @formatador.display_line
52
+ @formatador.display_table(table)
53
+ @formatador.display_line
57
54
  end
58
55
 
59
56
  def run(&block)
@@ -97,14 +94,14 @@ class Gestalt
97
94
  end
98
95
  end
99
96
 
100
- def self.profile(&block)
101
- gestalt = new
97
+ def self.profile(formatador = Formatador.new, &block)
98
+ gestalt = new(formatador)
102
99
  gestalt.run(&block)
103
100
  gestalt.display_profile
104
101
  end
105
102
 
106
- def self.trace(&block)
107
- gestalt = new
103
+ def self.trace(formatador = Formatador.new, &block)
104
+ gestalt = new(formatador)
108
105
  gestalt.run(&block)
109
106
  gestalt.display_calls
110
107
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-26 00:00:00 -07:00
17
+ date: 2010-04-29 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency