Class: JsonUpdater::JsonValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/json_updater/json_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#messagesObject



15
16
17
18
# File 'lib/json_updater/json_validator.rb', line 15

def messages
  return "#{path} - file does't exist" unless file_exist?
  return "#{path} - json file doesn't valid" unless json_valid?
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/json_updater/json_validator.rb', line 11

def valid?
  file_exist? && json_valid?
end