Sha256: 664d063be977a8e6eb7feeeab59891644d8860d35599157d08f5f8b98297d215

Contents?: true

Size: 545 Bytes

Versions: 41

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

class MiniDefender::Rules::ExcludedWith < MiniDefender::Rule
  def initialize(target)
    raise ArgumentError, 'Target must be a string' unless target.is_a?(String)

    @target = target
  end

  def self.signature
    'excluded_with'
  end

  def self.make(args)
    raise ArgumentError, 'Target and expected value are required.' unless args.length == 1

    self.new(args[0])
  end

  def excluded?(validator)
    validator.data.key?(@target)
  end

  def passes?(attribute, value, validator)
    true
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
mini_defender-0.6.8 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.7 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.5 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.4 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.3 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.2 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.1 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.6.0 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.8 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.7 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.6 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.5 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.4 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.3 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.2 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.1 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.5.0 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.4.1 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.4.0 lib/mini_defender/rules/excluded_with.rb
mini_defender-0.3.14 lib/mini_defender/rules/excluded_with.rb