Class: JsonUpdater::JsonValidator
- Inherits:
-
Object
- Object
- JsonUpdater::JsonValidator
- Defined in:
- lib/json_updater/json_validator.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ JsonValidator
constructor
A new instance of JsonValidator.
- #messages ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ JsonValidator
Returns a new instance of JsonValidator.
7 8 9 |
# File 'lib/json_updater/json_validator.rb', line 7 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/json_updater/json_validator.rb', line 5 def path @path end |
Instance Method Details
#messages ⇒ Object
15 16 17 18 |
# File 'lib/json_updater/json_validator.rb', line 15 def return "#{path} - file does't exist" unless file_exist? return "#{path} - json file doesn't valid" unless json_valid? end |
#valid? ⇒ Boolean
11 12 13 |
# File 'lib/json_updater/json_validator.rb', line 11 def valid? file_exist? && json_valid? end |