poms 2.1.1 → 2.1.2
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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/lib/poms/fields.rb +28 -4
- data/lib/poms/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d268f605a793eec5d34d3eda6c400f679a07d2c1
|
4
|
+
data.tar.gz: 93aa682457183d55b7f959d124e8bbe1142bc433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f56dc3d7d826dee54d4edec5a93079b201ff257d1e9443633b67c437009d8c91291b42353fc6342430c0b4f36b8eeccc14d4135b100c9038e38fa1b0914754
|
7
|
+
data.tar.gz: 8fb05d5b1161e897a7c6dccdba6e21f608fd54fb9f1db641b444645a0eb9f89b81af292f23b75e233e4b50ff9472a5c274a23cb4068f178c359c500e7db092e3
|
data/.rubocop.yml
CHANGED
@@ -20,6 +20,9 @@ Style/AndOr:
|
|
20
20
|
- 'lib/poms.rb' # here we do rely on how `or` has lower precedence than `||`
|
21
21
|
- 'lib/poms/configuration.rb' # here we do rely on how `or` has lower precedence than `||`
|
22
22
|
|
23
|
+
Style/FrozenStringLiteralComment:
|
24
|
+
Enabled: false
|
25
|
+
|
23
26
|
ModuleLength:
|
24
27
|
Exclude:
|
25
28
|
- spec/**/*_spec.rb # specs are only in module for easier access to functions
|
data/CHANGELOG.md
CHANGED
data/lib/poms/fields.rb
CHANGED
@@ -65,10 +65,34 @@ module Poms
|
|
65
65
|
Timestamp.to_datetime(internetvod['publishStop'])
|
66
66
|
end
|
67
67
|
|
68
|
-
# Returns the
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
# Returns the index at which it is in the parent. When no
|
69
|
+
# :member_of keyword is given, it will return the first found
|
70
|
+
# index. Else, when a parent is found with matching member_of
|
71
|
+
# midref, it returns that index. Else returns nil.
|
72
|
+
# @param item The Poms Hash
|
73
|
+
# @param optional :member_of The midref of parent for which we
|
74
|
+
# seek the index
|
75
|
+
def position(item, member_of: nil)
|
76
|
+
parent(item, midref: member_of).try(:[], 'index')
|
77
|
+
end
|
78
|
+
|
79
|
+
# Finds a parent the data is "member of". If :midref is given, it
|
80
|
+
# will look for the parent that matches that mid and return nil if
|
81
|
+
# not found. Without the :midref it will return the first parent.
|
82
|
+
# @param item The Poms Hash
|
83
|
+
# @param optional midref The midref of parent we seek.
|
84
|
+
def parent(item, midref: nil)
|
85
|
+
if midref
|
86
|
+
parents(item).find { |parent| parent['midRef'] == midref }
|
87
|
+
else
|
88
|
+
parents(item).first
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Returns the parents that the element is member of. Will always
|
93
|
+
# return an array.
|
94
|
+
def parents(item)
|
95
|
+
Array(item['memberOf'])
|
72
96
|
end
|
73
97
|
|
74
98
|
# Returns an array of start and end times for the scheduled events for
|
data/lib/poms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Kruijsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|