Class: Shogun::Verifier::Allowed

Inherits:
Object
  • Object
show all
Defined in:
lib/shogun/verifier/allowed.rb

Instance Method Summary collapse

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

#contextObject



18
19
20
21
22
# File 'lib/shogun/verifier/allowed.rb', line 18

def context
  {
    "unallowed" => @data.reject(&method(:allowed?))
  }
end

#idObject



14
15
16
# File 'lib/shogun/verifier/allowed.rb', line 14

def id
  "#{@name}_not_allowed"
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/shogun/verifier/allowed.rb', line 10

def valid?
  @data.all?(&method(:allowed?))
end