Class: YamlNormalizer::Services::IsYaml
- Defined in:
- lib/yaml_normalizer/services/is_yaml.rb
Overview
IsYaml is a Service Class that provides functionality to check if a file is a parseable non-scalar YAML file.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
file is the file path String to be regarded.
Instance Method Summary collapse
-
#call ⇒ Object
Return true if given file is a valid YAML file.
-
#initialize(file) ⇒ IsYaml
constructor
Create an IsYaml service object by calling .new and passing a file path String.
Methods inherited from Base
Constructor Details
#initialize(file) ⇒ IsYaml
Create an IsYaml service object by calling .new and passing a file path String.
19 20 21 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 19 def initialize(file) @file = file.to_s end |
Instance Attribute Details
#file ⇒ Object (readonly)
file is the file path String to be regarded
14 15 16 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 14 def file @file end |
Instance Method Details
#call ⇒ Object
Return true if given file is a valid YAML file
24 25 26 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 24 def call file? && parseable? && !scalar? end |