Class: YamlNormalizer::Services::Check
- Includes:
- Helpers::Normalize, Helpers::ParamParser
- Defined in:
- lib/yaml_normalizer/services/check.rb
Overview
Check is a service class that provides functionality to check if giving YAML files are already standardized (normalized).
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
files is a sorted array of file path Strings.
Instance Method Summary collapse
-
#call ⇒ Object
Normalizes all YAML files defined on instantiation.
-
#initialize(*args) ⇒ Check
constructor
Create a Check service object by calling .new and passing one or more Strings that are interpreted as file glob pattern.
Methods included from Helpers::ParamParser
#parse_params, #print_help, #print_version
Methods included from Helpers::Normalize
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ Check
Create a Check service object by calling .new and passing one or more Strings that are interpreted as file glob pattern.
22 23 24 25 26 27 |
# File 'lib/yaml_normalizer/services/check.rb', line 22 def initialize(*args) super parse_params(*args) files = args.each_with_object([]) { |a, o| o << Dir[a.to_s] } @files = files.flatten.sort.uniq end |
Instance Attribute Details
#files ⇒ Object (readonly)
files is a sorted array of file path Strings
17 18 19 |
# File 'lib/yaml_normalizer/services/check.rb', line 17 def files @files end |
Instance Method Details
#call ⇒ Object
Normalizes all YAML files defined on instantiation.
30 31 32 33 |
# File 'lib/yaml_normalizer/services/check.rb', line 30 def call success = files.pmap { |file| process(file) } success.all? end |