light-services 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/light/services/callbacks.rb +7 -1
- data/lib/light/services/parameters.rb +7 -1
- data/lib/light/services/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: 3b0a88af617cba88e9b2ee556591f0de1e4e78c1
|
4
|
+
data.tar.gz: 819d52f953b4737e80380894e510c8b55845fff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39418f43611a2b142c62049a258e9fd595e3be7b1b6a7cdbb67ebfb0d3b04d99680b2b1c624bfea55f5522e1e8bbc0db898cc68d3c50f20f2cafb31c86938b1c
|
7
|
+
data.tar.gz: 4b15da3bd2267a50fb19cbbf6bb0f5d4949857c7b73326d4cff73a82109f300d08ea18a6534434f1ff7c42253ce858c8813ef79e909210d97fa42e165c581a9e
|
@@ -22,7 +22,13 @@ module Light
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def callbacks_by(type)
|
25
|
-
|
25
|
+
all_callbacks.select { |callback| callback[:type] == type }
|
26
|
+
end
|
27
|
+
|
28
|
+
def all_callbacks
|
29
|
+
return @_all_callbacks if defined?(@_all_callbacks)
|
30
|
+
@_all_callbacks = self.class.ancestors.select { |klass| klass.ancestors.include?(::Light::Services::Base) }
|
31
|
+
.map(&:callbacks).compact.flatten.uniq
|
26
32
|
end
|
27
33
|
|
28
34
|
module ClassMethods
|
@@ -23,7 +23,7 @@ module Light
|
|
23
23
|
def initialize_params
|
24
24
|
self.parameters = {}
|
25
25
|
|
26
|
-
|
26
|
+
all_parameters.each do |options|
|
27
27
|
validate_parameter(options)
|
28
28
|
store_parameter(options)
|
29
29
|
end
|
@@ -31,6 +31,12 @@ module Light
|
|
31
31
|
generate_parameters_methods
|
32
32
|
end
|
33
33
|
|
34
|
+
def all_parameters
|
35
|
+
return @_all_parameters if defined?(@_all_parameters)
|
36
|
+
@_all_parameters = self.class.ancestors.select { |klass| klass.ancestors.include?(::Light::Services::Base) }
|
37
|
+
.map(&:parameters).compact.flatten.uniq
|
38
|
+
end
|
39
|
+
|
34
40
|
def validate_parameter(options)
|
35
41
|
if parameter_required?(options)
|
36
42
|
raise Light::Services::ParamRequired, "Parameter \"#{options[:name]}\" is required"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Emelianenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|