Class: Shogun::Verifier::Allowed
- Inherits:
-
Object
- Object
- Shogun::Verifier::Allowed
- Defined in:
- lib/shogun/verifier/allowed.rb
Instance Method Summary collapse
- #context ⇒ Object
- #id ⇒ Object
-
#initialize(name:, data:, list: []) ⇒ Allowed
constructor
A new instance of Allowed.
- #valid? ⇒ Boolean
Constructor Details
#initialize(name:, data:, list: []) ⇒ Allowed
Returns a new instance of Allowed.
4 5 6 7 8 |
# File 'lib/shogun/verifier/allowed.rb', line 4 def initialize(name:, data:, list: []) @data = data @name = name @list = list || [] end |
Instance Method Details
#context ⇒ Object
18 19 20 21 22 |
# File 'lib/shogun/verifier/allowed.rb', line 18 def context { "unallowed" => @data.reject(&method(:allowed?)) } end |
#id ⇒ Object
14 15 16 |
# File 'lib/shogun/verifier/allowed.rb', line 14 def id "#{@name}_not_allowed" end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/shogun/verifier/allowed.rb', line 10 def valid? @data.all?(&method(:allowed?)) end |