Class: YamlNormalizer::Services::IsYaml
- Includes:
- Helpers::Normalize
- 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 included from Helpers::Normalize
Methods inherited from Base
Constructor Details
#initialize(file) ⇒ IsYaml
Create an IsYaml service object by calling .new and passing a file path String.
21 22 23 24 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 21 def initialize(file) super @file = file.to_s end |
Instance Attribute Details
#file ⇒ Object (readonly)
file is the file path String to be regarded
16 17 18 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 16 def file @file end |
Instance Method Details
#call ⇒ Object
Return true if given file is a valid YAML file
27 28 29 |
# File 'lib/yaml_normalizer/services/is_yaml.rb', line 27 def call file? && parseable? && !scalar? end |