lite-statistics 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +9 -3
- data/lib/generators/lite/statistics/templates/install.rb +1 -3
- data/lib/lite/statistics.rb +3 -4
- data/lib/lite/statistics/descriptive.rb +30 -6
- data/lib/lite/statistics/monkey_patches.rb +26 -0
- data/lib/lite/statistics/version.rb +1 -1
- metadata +2 -3
- data/lib/lite/statistics/configuration.rb +0 -35
- data/lib/lite/statistics/enumerable.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5c18db2a915e224bdbb1a5c050981081c13f34a3d52d657ca9a4722ecabcdb0
|
4
|
+
data.tar.gz: a2dfefd9a035cae2c2a8edc94b780a223ef82d0e0bcba30749cb98bd5d2dc894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4985ecca273499b14fa2e017ca818c2fc9c0462f182f22cad0f5dd09080ff836eaf4b9a27b29defe2eacefaca20618e6684570c674d012edc995d93958277810
|
7
|
+
data.tar.gz: 8b2fa9ce8091ffe8947340878875079ec151b23ec530d8fd49c08d7c32cf0353ade26eefc36ca9efd812bd6cb382e4676048875c8980db8f3899fd2f9b15374f
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [2.0.0] - 2021-07-22
|
10
|
+
### Changed
|
11
|
+
- Update install generator to reflect configuration changes
|
12
|
+
### Removed
|
13
|
+
- Removed configuration to use explicit inclusions
|
14
|
+
|
9
15
|
## [1.2.1] - 2021-07-21
|
10
16
|
### Changed
|
11
17
|
- Improved Railtie support
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-statistics (
|
4
|
+
lite-statistics (2.0.0)
|
5
5
|
lite-memoize
|
6
6
|
|
7
7
|
GEM
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
railties (>= 3.0.0)
|
42
42
|
i18n (1.8.10)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
|
-
lite-memoize (1.1.
|
44
|
+
lite-memoize (1.1.1)
|
45
45
|
loofah (2.10.0)
|
46
46
|
crass (~> 1.0.2)
|
47
47
|
nokogiri (>= 1.5.9)
|
data/README.md
CHANGED
@@ -30,13 +30,19 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Configurations
|
32
32
|
|
33
|
+
Any and all monkey patches must be explicitly included anywhere you want to use it.
|
34
|
+
|
35
|
+
To globally use the monkey patches, just create an initializer requiring them.
|
36
|
+
|
33
37
|
`rails g lite:statistics:install` will generate the following file:
|
34
38
|
`../config/initalizers/lite_statistics.rb`
|
35
39
|
|
40
|
+
They can be disabled by commenting any of them out.
|
41
|
+
|
36
42
|
```ruby
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
# frozen_string_literal: true
|
44
|
+
|
45
|
+
require 'lite/statistics/monkey_patches'
|
40
46
|
```
|
41
47
|
|
42
48
|
## Descriptive
|
data/lib/lite/statistics.rb
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'generators/lite/statistics/install_generator' if defined?(Rails::Generators)
|
4
4
|
|
5
|
-
require 'lite/memoize'
|
5
|
+
require 'lite/memoize' unless defined?(Lite::Memoize)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
7
|
+
require 'lite/statistics/version'
|
8
|
+
require 'lite/statistics/descriptive'
|
@@ -7,12 +7,36 @@ module Lite
|
|
7
7
|
extend Lite::Memoize::Alias
|
8
8
|
|
9
9
|
CALCULATIONS = %i[
|
10
|
-
frequencies
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
frequencies
|
11
|
+
max
|
12
|
+
mean
|
13
|
+
median
|
14
|
+
midrange
|
15
|
+
min
|
16
|
+
mode
|
17
|
+
proportions
|
18
|
+
percentile_from_value
|
19
|
+
population_coefficient_of_variation
|
20
|
+
population_kurtosis
|
21
|
+
population_size
|
22
|
+
population_skewness
|
23
|
+
population_standard_deviation
|
24
|
+
population_standard_error
|
25
|
+
population_summary
|
26
|
+
population_variance
|
27
|
+
population_zscores
|
28
|
+
range
|
29
|
+
sample_coefficient_of_variation
|
30
|
+
sample_kurtosis
|
31
|
+
sample_size
|
32
|
+
sample_skewness
|
33
|
+
sample_standard_deviation
|
34
|
+
sample_standard_error
|
35
|
+
sample_summary
|
36
|
+
sample_variance
|
37
|
+
sample_zscores
|
38
|
+
sum
|
39
|
+
value_from_percentile
|
16
40
|
].freeze
|
17
41
|
|
18
42
|
def initialize(collection)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
EXCLUDED_DESCRIPTIVE_CALCULATIONS = %i[max min sum].freeze
|
6
|
+
|
7
|
+
Lite::Statistics::Descriptive::CALCULATIONS.each do |name|
|
8
|
+
next if EXCLUDED_DESCRIPTIVE_CALCULATIONS.include?(name)
|
9
|
+
|
10
|
+
define_method(name) { |*args| Lite::Statistics::Descriptive.send(name, self, *args) }
|
11
|
+
end
|
12
|
+
|
13
|
+
alias average mean
|
14
|
+
alias coefficient_of_variation sample_coefficient_of_variation
|
15
|
+
alias kurtosis sample_kurtosis
|
16
|
+
alias midextreme midrange
|
17
|
+
alias percentile percentile_from_value
|
18
|
+
alias percentile_rank value_from_percentile
|
19
|
+
alias skewness sample_skewness
|
20
|
+
alias standard_deviation sample_standard_deviation
|
21
|
+
alias standard_error sample_standard_error
|
22
|
+
alias summary sample_summary
|
23
|
+
alias variance sample_variance
|
24
|
+
alias zscores sample_zscores
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -201,9 +201,8 @@ files:
|
|
201
201
|
- lib/generators/lite/statistics/install_generator.rb
|
202
202
|
- lib/generators/lite/statistics/templates/install.rb
|
203
203
|
- lib/lite/statistics.rb
|
204
|
-
- lib/lite/statistics/configuration.rb
|
205
204
|
- lib/lite/statistics/descriptive.rb
|
206
|
-
- lib/lite/statistics/
|
205
|
+
- lib/lite/statistics/monkey_patches.rb
|
207
206
|
- lib/lite/statistics/version.rb
|
208
207
|
- lite-statistics.gemspec
|
209
208
|
homepage: http://drexed.github.io/lite-statistics
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lite
|
4
|
-
module Statistics
|
5
|
-
|
6
|
-
class Configuration
|
7
|
-
|
8
|
-
attr_accessor :monkey_patches
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@monkey_patches = true
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
class << self
|
17
|
-
|
18
|
-
attr_writer :configuration
|
19
|
-
|
20
|
-
def configuration
|
21
|
-
@configuration ||= Configuration.new
|
22
|
-
end
|
23
|
-
|
24
|
-
def configure
|
25
|
-
yield(configuration)
|
26
|
-
end
|
27
|
-
|
28
|
-
def reset_configuration!
|
29
|
-
@configuration = Configuration.new
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Lite::Statistics.configuration.monkey_patches
|
4
|
-
module Enumerable
|
5
|
-
|
6
|
-
EXCLUDED_DESCRIPTIVE_CALCULATIONS = %i[max min sum].freeze
|
7
|
-
|
8
|
-
Lite::Statistics::Descriptive::CALCULATIONS.each do |name|
|
9
|
-
next if EXCLUDED_DESCRIPTIVE_CALCULATIONS.include?(name)
|
10
|
-
|
11
|
-
define_method(name) { |*args| Lite::Statistics::Descriptive.send(name, self, *args) }
|
12
|
-
end
|
13
|
-
|
14
|
-
alias average mean
|
15
|
-
alias coefficient_of_variation sample_coefficient_of_variation
|
16
|
-
alias kurtosis sample_kurtosis
|
17
|
-
alias midextreme midrange
|
18
|
-
alias percentile percentile_from_value
|
19
|
-
alias percentile_rank value_from_percentile
|
20
|
-
alias skewness sample_skewness
|
21
|
-
alias standard_deviation sample_standard_deviation
|
22
|
-
alias standard_error sample_standard_error
|
23
|
-
alias summary sample_summary
|
24
|
-
alias variance sample_variance
|
25
|
-
alias zscores sample_zscores
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|