Sha256: f059376d24f4fb2eea2b679f5a73cf864de759ce8e2c9e914f4d7327dd7c463e
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
module Vanguard class Rule # Abstract base class for nullary rules class Nullary class Attribute < self include Equalizer.new(:attribute_name, :matcher) # Return attribute name # # @return [Symbol] # # @api private # attr_reader :attribute_name # Return matcher # # @return [Matcher] # # @api private # attr_reader :matcher # Initialize object # # @param [Symbol] attribute_name # the name of the attribute to validate. # # @return [undefined] # # @api private # def initialize(attribute_name, matcher) @attribute_name, @matcher = attribute_name, matcher end # Default evaluator class Evaluator < Vanguard::Evaluator # Test if value is valid # # @return [true] # if value is matched by matcher # # @return [false] # otherwise # # @api private # def valid? matcher.matches?(value) end memoize :valid? # Return matcher # # @return [Matcher] # # @api private # def matcher rule.matcher end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vanguard-0.0.5 | lib/vanguard/rule/nullary/attribute.rb |
vanguard-0.0.4 | lib/vanguard/rule/nullary/attribute.rb |
vanguard-0.0.3 | lib/vanguard/rule/nullary/attribute.rb |