Class: MiniDefender::Rules::ExcludedWithout
Class Method Summary
collapse
Instance Method Summary
collapse
#active?, available?, #bails?, #coerce, #default_value, #defaults?, #error_message, #force_coerce?, #implicit?, #message, #priority, #stops?, #with_message
Constructor Details
Returns a new instance of ExcludedWithout.
4
5
6
7
8
|
# File 'lib/mini_defender/rules/excluded_without.rb', line 4
def initialize(target)
raise ArgumentError, 'Target must be a string' unless target.is_a?(String)
@target = target
end
|
Class Method Details
.make(args) ⇒ Object
14
15
16
17
18
|
# File 'lib/mini_defender/rules/excluded_without.rb', line 14
def self.make(args)
raise ArgumentError, 'Target and expected value are required.' unless args.length == 1
self.new(args[0])
end
|
.signature ⇒ Object
10
11
12
|
# File 'lib/mini_defender/rules/excluded_without.rb', line 10
def self.signature
'excluded_without'
end
|
Instance Method Details
#excluded?(validator) ⇒ Boolean
20
21
22
|
# File 'lib/mini_defender/rules/excluded_without.rb', line 20
def excluded?(validator)
!validator.data.key?(@target)
end
|
#passes?(attribute, value, validator) ⇒ Boolean
24
25
26
|
# File 'lib/mini_defender/rules/excluded_without.rb', line 24
def passes?(attribute, value, validator)
true
end
|