choria-mcorpc-support 2.20.3 → 2.20.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,17 @@
1
1
  module MCollective
2
2
  module Validator
3
3
  @last_load = nil
4
- @@validator_mutex = Mutex.new
4
+ @@validator_mutex = Mutex.new # rubocop:disable Style/ClassVars
5
5
 
6
6
  # Loads the validator plugins. Validators will only be loaded every 5 minutes
7
7
  def self.load_validators
8
- begin
9
- @@validator_mutex.lock
10
- if load_validators?
11
- @last_load = Time.now.to_i
12
- PluginManager.find_and_load("validator")
13
- end
14
- ensure
15
- @@validator_mutex.unlock
8
+ @@validator_mutex.lock
9
+ if load_validators?
10
+ @last_load = Time.now.to_i
11
+ PluginManager.find_and_load("validator")
16
12
  end
13
+ ensure
14
+ @@validator_mutex.unlock
17
15
  end
18
16
 
19
17
  # Returns and instance of the Plugin class from which objects can be created.
@@ -24,7 +22,7 @@ module MCollective
24
22
  def self.[](klass)
25
23
  if klass.is_a?(Symbol)
26
24
  klass = validator_class(klass)
27
- elsif !(klass.match(/.*Validator$/))
25
+ elsif !klass.match(/.*Validator$/)
28
26
  klass = validator_class(klass)
29
27
  end
30
28
 
@@ -32,9 +30,9 @@ module MCollective
32
30
  end
33
31
 
34
32
  # Allows validation plugins to be called like module methods : Validator.validate()
35
- def self.method_missing(method, *args, &block)
33
+ def self.method_missing(method, *args, &block) # rubocop:disable Style/MethodMissing
36
34
  if has_validator?(method)
37
- validator = Validator[method].validate(*args)
35
+ Validator[method].validate(*args)
38
36
  else
39
37
  raise ValidatorError, "Unknown validator: '#{method}'."
40
38
  end
@@ -64,17 +62,17 @@ module MCollective
64
62
 
65
63
  else
66
64
  case validation
67
- when Regexp,String
68
- Validator.regex(validator, validation)
65
+ when Regexp, String
66
+ Validator.regex(validator, validation)
69
67
 
70
- when Symbol
71
- Validator.send(validation, validator)
68
+ when Symbol
69
+ Validator.send(validation, validator)
72
70
 
73
- when Array
74
- Validator.array(validator, validation)
71
+ when Array
72
+ Validator.array(validator, validation)
75
73
 
76
- when Class
77
- Validator.typecheck(validator, validation)
74
+ when Class
75
+ Validator.typecheck(validator, validation)
78
76
  end
79
77
  end
80
78
  rescue => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choria-mcorpc-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.20.3
4
+ version: 2.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.I.Pienaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-30 00:00:00.000000000 Z
11
+ date: 2018-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.2.4
39
+ version: 0.5.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.2.4
46
+ version: 0.5.0
47
47
  description: Libraries enabling Ruby support for the Choria Orchestration Server
48
48
  email: rip@devco.net
49
49
  executables: