was 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99421529aa08811e583cff20a0e7d41e110aaad70976b8ef6e52a7bda38feab6
4
- data.tar.gz: 70b2035d1d5b2ee5937810efd7f337b9133e0b87b5f68434ece9bc796ffb16dd
3
+ metadata.gz: dec886b6732bed51319bb2b25188fdb8bfaebc1a731ed2586b3b048d06e31253
4
+ data.tar.gz: 15a9386c210b0b7f996b1c96890bfaf20b5006e9c492f6078ad55195b34654c7
5
5
  SHA512:
6
- metadata.gz: d5cff77d12a2a61eff5c1a0c131bfbc831e43c0b67d9761b9f44146a1307d6d2c08165f28e1a4d644b19c29b582e0479390135818dade2f344a24c323b8fb3eb
7
- data.tar.gz: cbfe391a566ffe9b0ce431d3975e4abfdace7dc3194f3fa9b35430a50d571a81e7c0b9baadd1dfe2f29f2e1c8ad59001e6165d41cf9a3943f25e2615c9f42769
6
+ metadata.gz: 2eceb9767ae5b5e96117c59dc5d38170fdeb01947b6a4dc3691040065e750dd5e83c9d18c38c79f10ecb72bf4167de4dcae2702c466f1b5810a71d4122e21369
7
+ data.tar.gz: 29b21a7e3e39272fae787029e7e4c73cf2bc74abfe3369142c08b98eb1f0613c40c19738e2741094de743cfa68496ffa416837d29454e856ce2ba9b3b6172dff
data/README.md CHANGED
@@ -20,6 +20,8 @@ Scenario:
20
20
  ### Define score classes
21
21
 
22
22
  ```ruby
23
+ require "was"
24
+
23
25
  class ReportScore < WAS::Score
24
26
  maximum_score 1000
25
27
 
@@ -58,3 +60,22 @@ ReportScore.new(
58
60
  ).calculate
59
61
  #> 250
60
62
  ````
63
+
64
+ ### Compose without generating a total score
65
+
66
+ Omitting the `maximum_score` will return a composed percentage represented as a value between `0` and `1`.
67
+
68
+ ```ruby
69
+ class ComposedScore < WAS::Score
70
+ with "ExamScore", weight: 0.75
71
+ with "PracticalScore", weight: 0.25
72
+ end
73
+ ```
74
+
75
+ ```ruby
76
+ ComposedScore.new({
77
+ exam: "A",
78
+ practical: 5
79
+ }).calculate
80
+ #> 0.875
81
+ ```
data/lib/was/score.rb CHANGED
@@ -7,7 +7,7 @@ module WAS
7
7
  end
8
8
 
9
9
  def self.max_score
10
- @maximum_score
10
+ @maximum_score || 1
11
11
  end
12
12
 
13
13
  def self.with(klass, weight: 0)
data/lib/was/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WAS
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: was
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Connell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-10 00:00:00.000000000 Z
11
+ date: 2025-02-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple gem/dsl for generating Weighted Average Score calculations.
14
14
  email: