low_event 0.6.0 → 0.7.0
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/lib/events/status_event.rb +9 -2
- data/lib/interfaces/definable.rb +2 -0
- data/lib/interfaces/event.rb +19 -0
- data/lib/version.rb +1 -1
- 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: 795d5b01229eb54ebe8f4a6ed2b19567f6076d4fade5fe84f3d4fb52eca08a33
|
|
4
|
+
data.tar.gz: 3763c499defe0d8bf63dbcdbfa5913bcf670acfe9e34992c38d43a2fc49aec07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04e478f509ad364b1fb67c14674264905013024b37ac52f0e737e354981f424842879d67b06656ad68c03375f069fcfc84b2a782fe05d9704465bd649d0991aa
|
|
7
|
+
data.tar.gz: cff5e78df4c69a0cc862c11b80b1a115fcd1b7d1d7819f09ce3269da0f1bd7b48cae9f0a13bf305149e786befa2fce9b34989365a927c26bb3bc4a192cb69649
|
data/lib/events/status_event.rb
CHANGED
|
@@ -7,12 +7,19 @@ module Low
|
|
|
7
7
|
class StatusEvent < Event
|
|
8
8
|
attr_reader :status, :request
|
|
9
9
|
|
|
10
|
-
def initialize(status:, request:, action: :render)
|
|
11
|
-
super(key: status, action:)
|
|
10
|
+
def initialize(status:, request:, key: nil, action: :render)
|
|
11
|
+
super(key: key || status, action:)
|
|
12
12
|
|
|
13
13
|
@status = status
|
|
14
14
|
@request = request
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
# Status is a complex type that can be represented by both "Status" generically and "Status[:code]" specifically.
|
|
18
|
+
class << self
|
|
19
|
+
def trigger(status:, **kwargs)
|
|
20
|
+
new(status:, **kwargs).trigger || new(status:, key: Status, **kwargs).trigger
|
|
21
|
+
end
|
|
22
|
+
end
|
|
16
23
|
end
|
|
17
24
|
end
|
|
18
25
|
end
|
data/lib/interfaces/definable.rb
CHANGED
data/lib/interfaces/event.rb
CHANGED
|
@@ -51,6 +51,25 @@ module Low
|
|
|
51
51
|
|
|
52
52
|
def inherited(child)
|
|
53
53
|
child.include LowType
|
|
54
|
+
|
|
55
|
+
increase_count
|
|
56
|
+
add_event(child)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def count
|
|
60
|
+
@count ||= 0
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def increase_count
|
|
64
|
+
@count = count + 1
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def events
|
|
68
|
+
@events ||= []
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def add_event(event)
|
|
72
|
+
events << event
|
|
54
73
|
end
|
|
55
74
|
end
|
|
56
75
|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: low_event
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maedi
|
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
107
|
version: '0'
|
|
108
108
|
requirements: []
|
|
109
|
-
rubygems_version: 4.0.
|
|
109
|
+
rubygems_version: 4.0.10
|
|
110
110
|
specification_version: 4
|
|
111
111
|
summary: Observable events
|
|
112
112
|
test_files: []
|