Sha256: dfd3773d4aaed1b066bca36ba792ac88124d96ae8ccbd15f155aa3ccef3ea844

Contents?: true

Size: 506 Bytes

Versions: 41

Compression:

Stored size: 506 Bytes

Contents

# frozen_string_literal: true

require_relative 'date_eq'

class MiniDefender::Rules::DateGt < MiniDefender::Rules::DateEq
  def self.signature
    'date_gt'
  end

  def passes?(attribute, value, validator)
    value = parse_date(value)
    @valid_value = true

    value > @target_date
  rescue ArgumentError
    false
  end

  def message(attribute, value, validator)
    return "The given value is not a valid date." unless @valid_value

    "The value must be greater than #{@target_date}."
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

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