Class: Vanguard::Rule::Nullary::Attribute::Length::Evaluator

Inherits:
Evaluator show all
Defined in:
lib/vanguard/rule/nullary/attribute/length.rb

Overview

Evaluator for length rules

Instance Attribute Summary

Attributes inherited from Evaluator

#resource, #rule

Instance Method Summary collapse

Methods inherited from Evaluator

#matcher

Methods inherited from Evaluator

#initialize, #value, #violation, #violations

Constructor Details

This class inherits a constructor from Vanguard::Evaluator

Instance Method Details

#lengthFixnum

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return length

Returns:

  • (Fixnum)


174
175
176
# File 'lib/vanguard/rule/nullary/attribute/length.rb', line 174

def length
  value.length
end

#valid?true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if value is valid

Returns:

  • (true)

    if value is valid

  • (false)

    otherwise



163
164
165
# File 'lib/vanguard/rule/nullary/attribute/length.rb', line 163

def valid?
  matcher.matches?(length)
end