tiny_outcome 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_outcome.rb +4 -2
  3. metadata +31 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3611d8970ea3a209328e2149c518dc2c8ea0e15c8297ec6951d63c0d2c9d2ce1
4
- data.tar.gz: 0bb76d7481157879e2d7a4e0b0d3edfc87bb96af5a85c5c3dc64187e9b53c6af
3
+ metadata.gz: ccac5bae17f87452576130e604477b25fbaaa70785e0a41894077e8896521a28
4
+ data.tar.gz: f108cdf6533898223d088a169645d2b0ddc897c857c725c713086f42519a9d74
5
5
  SHA512:
6
- metadata.gz: 10d7cea58b4f4bdf02988ff2ab3fcb91ee3f28dea1df19ddaa2e0fff2d3f7090e39dd4f696985926e688ae320128dab7d96708aee3f87c3cb8bff026d075c353
7
- data.tar.gz: 5646f503b6998e99df4d68e21a10f70344d3e9e9f0aa363e9b751d2def1664924a286319c022867fc0019cce5f2f40ee74b0792bf18ef67c156af88681805da8
6
+ metadata.gz: 12b256504992f76ca4e6a22af2b5a9e24699062765f3bf1acb6f9d1e24f9fceefcbf865e856371ab4bf85c9a20fef6923e8582bb9c87b37571bbdba4d1271752
7
+ data.tar.gz: fedc09804f2e2c2007cf05e83f0971a2f54a5e9dcb18a2cf245fd5d907e60813f83de23e55024b323bd065cda7acc08d6504928ea1706871b465831326ac33fe
data/lib/tiny_outcome.rb CHANGED
@@ -86,7 +86,8 @@ class TinyOutcome
86
86
  # probabilty = ---------------
87
87
  # total samples
88
88
  def probability
89
- (value.to_s(2).count('1') / samples.to_f).round(2)
89
+ return 0.0 if samples == 0
90
+ value.to_s(2).count('1') / samples.to_f
90
91
  end
91
92
 
92
93
  # true if we've received at least warmup number of samples
@@ -111,7 +112,8 @@ class TinyOutcome
111
112
  [:value,
112
113
  :samples,
113
114
  :warmth,
114
- :warmup,:warm?,
115
+ :warmup,
116
+ :warm?,
115
117
  :probability,
116
118
  ].each_with_object({}) do |attr, memo|
117
119
  memo[attr] = send(attr)
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_outcome
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: m
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: a tiny outcome tracker with almost no features
14
42
  email: jefflunt@gmail.com
15
43
  executables: []