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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55389c266679d265dc5db51cc411bf91a5b1bf89
4
- data.tar.gz: 59522df9e2f321abd85ad2838c6af98a33d6cd27
3
+ metadata.gz: 3b0a88af617cba88e9b2ee556591f0de1e4e78c1
4
+ data.tar.gz: 819d52f953b4737e80380894e510c8b55845fff7
5
5
  SHA512:
6
- metadata.gz: 1c88ee68d4b7d9e6f847477bb2ce5c776821522ea54d1155f4f082e043b992538fac354e7a618601973159193e9c95b775a80711131bcbd5cce4f1fbf88b2b64
7
- data.tar.gz: 72fcafe816d15d28ba2b46e07387283e23875adb94accaf437828b0be88da72dae1ad989fe633f451b2b580df5de72a082ab491a923ff640931157e199e24c17
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
- (self.class.callbacks || []).select { |callback| callback[:type] == type }
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
- (self.class.parameters || []).each do |options|
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"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Light
4
4
  module Services
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
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.0
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-27 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails