Class: YMLValidator::Base
- Inherits:
-
Object
- Object
- YMLValidator::Base
- Defined in:
- lib/yml_validator/base.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#file_to_validate ⇒ Object
Returns the value of attribute file_to_validate.
-
#normalized_file ⇒ Object
Returns the value of attribute normalized_file.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Base
constructor
A new instance of Base.
- #valid? ⇒ Boolean
Constructor Details
#initialize(file_path) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/yml_validator/base.rb', line 7 def initialize file_path @file_path = file_path end |
Instance Attribute Details
#file_path ⇒ Object
Returns the value of attribute file_path.
3 4 5 |
# File 'lib/yml_validator/base.rb', line 3 def file_path @file_path end |
#file_to_validate ⇒ Object
Returns the value of attribute file_to_validate.
4 5 6 |
# File 'lib/yml_validator/base.rb', line 4 def file_to_validate @file_to_validate end |
#normalized_file ⇒ Object
Returns the value of attribute normalized_file.
5 6 7 |
# File 'lib/yml_validator/base.rb', line 5 def normalized_file @normalized_file end |
Instance Method Details
#valid? ⇒ Boolean
11 12 13 14 15 16 17 18 19 |
# File 'lib/yml_validator/base.rb', line 11 def valid? begin @file_to_validate = YAML.load_file(@file_path) rescue Psych::SyntaxError => e return false end validate end |