benelux 0.5.13 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,6 +1,13 @@
1
1
  BENELUX, CHANGES
2
2
 
3
- #### 0.5.13 (2010-03-??) ##############################
3
+
4
+ #### 0.5.14 (2010-03-23) ##############################
5
+
6
+ New dependency: storable >= 0.6.5
7
+
8
+ * CHANGE: Stats::Calculator now uses Storable
9
+
10
+ #### 0.5.13 (2010-03-20) ##############################
4
11
 
5
12
  * FIXED: Benelux::Stats::Calculator#merge! checks @n instead of @sum
6
13
  * CHANGE: Don't merge when the other Calculator has 0 samples.
data/benelux.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "benelux"
3
3
  s.rubyforge_project = 'benelux'
4
- s.version = "0.5.13"
4
+ s.version = "0.5.14"
5
5
  s.summary = "Benelux: A mad way to time Ruby codes"
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -13,6 +13,8 @@
13
13
  s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.rdoc"]
14
14
  s.require_paths = %w[lib]
15
15
 
16
+ s.add_dependency("storable", [">= 0.6.5"])
17
+
16
18
  # = MANIFEST =
17
19
  # git ls-files
18
20
  s.files = %w(
data/lib/benelux.rb CHANGED
@@ -4,7 +4,7 @@ require 'thwait'
4
4
  require 'selectable'
5
5
 
6
6
  module Benelux
7
- VERSION = "0.5.13"
7
+ VERSION = "0.5.14"
8
8
  NOTSUPPORTED = [Class, Object, Kernel]
9
9
 
10
10
  class BeneluxError < RuntimeError; end
data/lib/benelux/stats.rb CHANGED
@@ -122,10 +122,16 @@ module Benelux
122
122
  end
123
123
 
124
124
  # Based on Mongrel::Stats, Copyright (c) 2005 Zed A. Shaw
125
- class Calculator
125
+ class Calculator < Storable
126
126
  include Selectable::Object
127
127
 
128
- attr_reader :sum, :sumsq, :n, :min, :max
128
+ field :mean => Float
129
+ field :sd => Float
130
+ field :sum => Float
131
+ field :sumsq => Float
132
+ field :n => Integer
133
+ field :min => Float
134
+ field :max => Float
129
135
 
130
136
  def initialize
131
137
  reset
@@ -221,24 +227,6 @@ module Benelux
221
227
  end
222
228
  end
223
229
 
224
- def to_hash
225
- { :min => min, :mean => mean, :max => max, :sd => sd, :n => n, :sum => @sum, :sumsq => @sumsq }
226
- end
227
-
228
- def self.from_hash(hash={})
229
- me = new
230
- me.instance_variable_set '@min', hash[:min] || hash['min']
231
- me.instance_variable_set '@max', hash[:max] || hash['max']
232
- me.instance_variable_set '@n', hash[:n] || hash['n']
233
- me.instance_variable_set '@sum', hash[:sum] || hash['sum']
234
- me.instance_variable_set '@sumsq', hash[:sumsq] || hash['sumsq']
235
- me
236
- end
237
-
238
- def to_json
239
- to_hash.to_json
240
- end
241
-
242
230
  def ==(other)
243
231
  return false unless self.class == other.class
244
232
  a=([@sum, @min, @max, @n, @sumsq] -
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benelux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-20 00:00:00 -04:00
12
+ date: 2010-03-23 00:00:00 -04:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: storable
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.6.5
24
+ version:
16
25
  description: "Benelux: A mad way to time Ruby codes"
17
26
  email: delano@solutious.com
18
27
  executables: []