class Shogun::Verifier::Allowed
Public Class Methods
new(name:, data:, list: [])
click to toggle source
# File lib/shogun/verifier/allowed.rb, line 4 def initialize(name:, data:, list: []) @data = data @name = name @list = list || [] end
Public Instance Methods
context()
click to toggle source
# File lib/shogun/verifier/allowed.rb, line 18 def context { "unallowed" => @data.reject(&method(:allowed?)) } end
id()
click to toggle source
# File lib/shogun/verifier/allowed.rb, line 14 def id "#{@name}_not_allowed" end
valid?()
click to toggle source
# File lib/shogun/verifier/allowed.rb, line 10 def valid? @data.all?(&method(:allowed?)) end
Private Instance Methods
allowed?(item)
click to toggle source
# File lib/shogun/verifier/allowed.rb, line 24 def allowed?(item) @list.include?(item) end