coconductor 0.8.3 → 0.9.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: fb8c8fc5b15b69abac508b7760ecf97b7a407da9afade75ffc6dbb9379441832
4
- data.tar.gz: e6a8229720bd964c96fc44811d99ba49ea217a5a3d200d6db08d87e96a5af95d
3
+ metadata.gz: b71c775a757f82264c097801280f182591524317178c4e3116d6b6c4f123d086
4
+ data.tar.gz: 2e3cde6e96c80a419e43f0bafaca5ecb2f263b8d58a93b688d746cdedccac3d6
5
5
  SHA512:
6
- metadata.gz: 5994ee69cf976ef579f1834ef146b985874c20f72ceb2bc11cff97971dcd5870cf4cd9a8a578c7cd911344203a36dccd7839d23f196dd6a01830a56414c77a68
7
- data.tar.gz: a0c75ecfdabb7bc483697961baede66367d7769b594ca9b36d06d410c8ab4e3116be424fb855c398bc1cac9a6cad0846a2ace57cc0a8e9ad86cb64c212fd0f9b
6
+ metadata.gz: 0c452909e461a7311b4d9022c427319a025a7b9788e0a8d3883e93b530e82ed0ccf5ee90218c49731ac8699e7b3a97e2806a7f881b60bc43ffe31bba9e8d64d7
7
+ data.tar.gz: 337bc8152131a12b6686640560f5695569bfd0d3a2aa83a30ee59f31eb4a7babe67e0752793ca756366210e37d030a7b4794addf3ed2e86f9a096edd7e100464
@@ -123,9 +123,6 @@ module Coconductor
123
123
  # See https://github.com/stumpsyn/policies/pull/21
124
124
  @content ||= if parts.nil?
125
125
  nil
126
- elsif citizen_code_of_conduct?
127
- fields = %w[COMMUNITY_NAME GOVERNING_BODY]
128
- parts.last.gsub(/ (#{Regexp.union(fields)}) /, ' [\1] ')
129
126
  else
130
127
  parts.last
131
128
  end
@@ -155,10 +152,23 @@ module Coconductor
155
152
  other? || none?
156
153
  end
157
154
 
155
+ # Returns all fields found in the code of conduct
156
+ #
157
+ # Each field will have a unique _raw_text_, uniq-ing _identical_ fields
158
158
  def fields
159
159
  @fields ||= Field.from_code_of_conduct(self)
160
160
  end
161
161
 
162
+ # Returns all fields found in the code of conduct, uniq'd by normalized key
163
+ #
164
+ # Where the same field exists twice, preferance will be given to the first
165
+ # occurance to contain a description
166
+ def unique_fields
167
+ @unique_fields ||= begin
168
+ fields.sort_by { |f| f.description ? 0 : 1 }.uniq(&:key)
169
+ end
170
+ end
171
+
162
172
  def ==(other)
163
173
  other.is_a?(CodeOfConduct) && key == other.key
164
174
  end
@@ -28,7 +28,7 @@ module Coconductor
28
28
  new(m[0], name: m[:name], description: m[:description])
29
29
  end
30
30
 
31
- fields.uniq(&:key)
31
+ fields.uniq(&:raw_text)
32
32
  end
33
33
 
34
34
  # Returns all fields accross all vendored codes of conduct
@@ -1,3 +1,3 @@
1
1
  module Coconductor
2
- VERSION = '0.8.3'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coconductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter