job_spec 0.2.4 → 0.2.5

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
  SHA1:
3
- metadata.gz: 4d590a6b3f4138ca8f2aa028bf1bd2af113f2473
4
- data.tar.gz: 4a56478ca7176bd641ec0c8f8c863d4ded87c3ea
3
+ metadata.gz: baf6c46db69ad8de79584def5d8381f7bfbb78e0
4
+ data.tar.gz: 5c6fe728e4ff922858b94fb05f5a7340fc1f0cd4
5
5
  SHA512:
6
- metadata.gz: cfd405fc8d74fceb28e71fcaaceaf4bc6c3ecde639720b88be353b57e19a619f8ab2d8cf58eda435d2559f21c3540ddaf34af2cf6623ce9dc326b4cd7b2d5fcf
7
- data.tar.gz: 682005267b429921b0c02c1e98b8dcdcb5c50232273a17eadeb2ff10bfe1a85c5252d63ff0f458c3756828c24aff3983387ffdf10d7a4a38639de91286690190
6
+ metadata.gz: f30cea6a08168757f14b5bc58be6413adc978c3ce5d69ced30c04dc6c3f1a1fd15ea4ef2c4aa74239ff8f27e5835120063aac20584b3afbf44a37472e0fa1027
7
+ data.tar.gz: 4fdb2cbb3b5e174f9fb796fd1c8853f3e084cd37c70ed980c72797a9d41d944c7374b77281d51a7047a4b07f72b6368a1063be30872d0cbec705032ef57da466
@@ -11,12 +11,28 @@ module JobSpec
11
11
  markdown << "# #{role.name}"
12
12
  markdown << role.description unless role.description.nil?
13
13
 
14
- role.expectations.map(&:values).each do |(expectation, description)|
15
- markdown << "## #{expectation[0].upcase}#{expectation[1..expectation.length]}"
16
- markdown << description unless description.nil?
14
+ grouped_expectations.each do |group, expectations|
15
+ if group.nil?
16
+ markdown << '## Expectations' unless role.expectations.empty?
17
+ else
18
+ markdown << "## #{group}"
19
+ end
20
+
21
+ expectations.map(&:values).each do |(expectation, description)|
22
+ markdown << "### #{expectation[0].upcase}#{expectation[1..expectation.length]}"
23
+ markdown << description unless description.nil?
24
+ end
17
25
  end
18
26
 
19
27
  markdown.join("\n\n")
20
28
  end
29
+
30
+ private
31
+
32
+ def grouped_expectations
33
+ role.expectations.group_by do |expectations|
34
+ expectations[:group]
35
+ end
36
+ end
21
37
  end
22
38
  end
@@ -27,12 +27,12 @@ module JobSpec
27
27
  @salary = @salary || range
28
28
  end
29
29
 
30
- def include(role_expectations)
31
- @expectations.concat(role_expectations.to_a)
30
+ def include(role_expectations, as:)
31
+ @expectations.concat(role_expectations.to_a.map { |expectation| expectation.merge(group: as) })
32
32
  end
33
33
 
34
34
  def expected(expectation, description = nil)
35
- @expectations << { expectation: expectation, description: description }
35
+ @expectations << { expectation: expectation, description: description, group: nil }
36
36
  end
37
37
 
38
38
  def expectations
@@ -1,3 +1,3 @@
1
1
  module JobSpec
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Morton