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 +4 -4
- data/lib/coconductor/code_of_conduct.rb +13 -3
- data/lib/coconductor/field.rb +1 -1
- data/lib/coconductor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b71c775a757f82264c097801280f182591524317178c4e3116d6b6c4f123d086
|
4
|
+
data.tar.gz: 2e3cde6e96c80a419e43f0bafaca5ecb2f263b8d58a93b688d746cdedccac3d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/coconductor/field.rb
CHANGED
data/lib/coconductor/version.rb
CHANGED