Class: EasyJSONMatcher::ValidationRule

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_json_matcher/validation_rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, rule) ⇒ ValidationRule

Returns a new instance of ValidationRule.



7
8
9
10
# File 'lib/easy_json_matcher/validation_rules.rb', line 7

def initialize(type, rule)
  @type = type
  @rule = rule
end

Instance Attribute Details

#ruleObject (readonly)

Returns the value of attribute rule.



5
6
7
# File 'lib/easy_json_matcher/validation_rules.rb', line 5

def rule
  @rule
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/easy_json_matcher/validation_rules.rb', line 5

def type
  @type
end

Instance Method Details

#call(value, errors) ⇒ Object



12
13
14
# File 'lib/easy_json_matcher/validation_rules.rb', line 12

def call(value, errors)
  rule.call(value, errors)
end