Class: EasyJSONMatcher::StringValidator

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

Instance Attribute Summary

Attributes inherited from Validator

#content, #errors, #key, #required

Instance Method Summary collapse

Methods inherited from Validator

#_check_content_type, #_check_required?, #_create_validator, #_no_errors?, #_post_initialise, #_set_content, #get_errors, #initialize, #reset!, #valid?

Constructor Details

This class inherits a constructor from EasyJSONMatcher::Validator

Instance Method Details

#_content_is_a_string?Boolean

Returns:

  • (Boolean)


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

def _content_is_a_string?
  errors << "#{content} is not a String" unless content.is_a? String
end

#_validateObject



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

def _validate
  # Could possible have a meta-method here that takes a list of symbols representing validator names
  # and executes them in the validator of self.
  _content_is_a_string?
end