gh-events 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gh/events/version.rb +1 -1
- data/lib/gh/events.rb +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 536867ca0996403c7c14af95cdcc0fe09d64ff0f0255b1108807dc4b41e64043
|
4
|
+
data.tar.gz: 5c42253ec777d1d387969f9bb82ef4937b483234f8d1a385c15924b59b930f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed7a3180d966c34198af9c43f6be039bf873f5c75c9a04161be7c3019017edd0680c4386165f84e047f8bff9c297de00e26f8a834141f200b80d4d0c54114d6
|
7
|
+
data.tar.gz: ba6a71ca37b15b4f43f95e463f6ae74cd96e75cd537e39e0dcf6ebb5c148020c61b8f3e43edc55133f911604091ef952c5d3f7916a7e00db12cb2e3e3d78a8a2
|
data/Gemfile.lock
CHANGED
data/lib/gh/events/version.rb
CHANGED
data/lib/gh/events.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "gh/events/version"
|
2
2
|
|
3
3
|
require 'yaml'
|
4
|
+
require 'ostruct'
|
4
5
|
|
5
6
|
module GH
|
6
7
|
module Events
|
@@ -12,8 +13,11 @@ module GH
|
|
12
13
|
HEURISTICS = YAML.load_file(PATH)
|
13
14
|
|
14
15
|
def typeof(payload)
|
15
|
-
|
16
|
+
payload = payload.marshal_dump if payload.is_a?(OpenStruct)
|
17
|
+
keys = payload.keys.map(&:to_s)
|
16
18
|
HEURISTICS.each do |type, characteristics|
|
19
|
+
# puts ("-" * 30) + " #{type}"
|
20
|
+
|
17
21
|
# all keys in `present` are there
|
18
22
|
x = ((characteristics['present'] || []) - keys)
|
19
23
|
next unless x.empty?
|
@@ -26,8 +30,9 @@ module GH
|
|
26
30
|
z = payload.dup.merge(characteristics['exactly'] || {}) == payload
|
27
31
|
next unless z
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
n = characteristics['number_of_keys'] &&
|
34
|
+
keys.count != characteristics['number_of_keys']
|
35
|
+
next if n
|
31
36
|
|
32
37
|
return type.to_sym
|
33
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Hofmann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|