Sha256: 653734ab9ba5bcf48e8217ff85522ce7d813cb845f20696b18b764d6af8c3eec

Contents?: true

Size: 504 Bytes

Versions: 41

Compression:

Stored size: 504 Bytes

Contents

# frozen_string_literal: true

class MiniDefender::Rules::Confirmed < MiniDefender::Rule
  def initialize
    @found = false
  end

  def self.signature
    'confirmed'
  end

  def passes?(attribute, value, validator)
    key = "#{attribute}_confirmation"
    (@found = validator.data.key?(key)) && value == validator.data[key]
  end

  def message(attribute, value, validator)
    if @found
      'The value confirmation does not match.'
    else
      'The value must be confirmed.'
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

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