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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad6ae8a867cf6f264c243d39f229d66748f348bd45c8a109106838383e8ef832
4
- data.tar.gz: 9de177f7d5858d2a61b842c629db1435c3a61aaa0ceb67538f1e04eb5d7832cb
3
+ metadata.gz: a5c18db2a915e224bdbb1a5c050981081c13f34a3d52d657ca9a4722ecabcdb0
4
+ data.tar.gz: a2dfefd9a035cae2c2a8edc94b780a223ef82d0e0bcba30749cb98bd5d2dc894
5
5
  SHA512:
6
- metadata.gz: '049f7d696a8f78c09d164987dffbbee3ad59db09a09118db6488e0348e1797f1e3e68824966fc31010621bd2e0944734102a1d8f8abcfde8dab8a1cbb427c327'
7
- data.tar.gz: 34b7e2cf7abd8e8b5a21524452d54aa4f391fb03e92b10dcd5631c86e3476f83ef533b49248a1f3c01f094c352856fe6d0386fa95ca660a5a2f77d6b347c4aa7
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 (1.2.1)
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.0)
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
- Lite::Statistics.configure do |config|
38
- config.monkey_patches = true
39
- end
43
+ # frozen_string_literal: true
44
+
45
+ require 'lite/statistics/monkey_patches'
40
46
  ```
41
47
 
42
48
  ## Descriptive
@@ -1,5 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Lite::Statistics.configure do |config|
4
- config.monkey_patches = true
5
- end
3
+ require 'lite/statistics/monkey_patches'
@@ -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
- %w[version configuration descriptive enumerable].each do |filename|
8
- require "lite/statistics/#{filename}"
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 max mean median midrange min mode proportions percentile_from_value
11
- population_coefficient_of_variation population_kurtosis population_size population_skewness
12
- population_standard_deviation population_standard_error population_summary
13
- population_variance population_zscores range sample_coefficient_of_variation sample_kurtosis
14
- sample_size sample_skewness sample_standard_deviation sample_standard_error sample_summary
15
- sample_variance sample_zscores sum value_from_percentile
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
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Statistics
5
5
 
6
- VERSION = '1.2.1'
6
+ VERSION = '2.0.0'
7
7
 
8
8
  end
9
9
  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: 1.2.1
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/enumerable.rb
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