lib/yaml-validator.rb in yaml-validator-0.1.5 vs lib/yaml-validator.rb in yaml-validator-0.1.6
- old
+ new
@@ -6,11 +6,10 @@
class YamlValidator
def initialize(root_path, options = {})
@options = options
- @options[:show_missing] ||= true
@root_path = root_path
end
def en
return @en unless @en.nil?
@@ -52,12 +51,15 @@
errors = validate_root_language(yaml_object, File.basename(filename))
yaml_object = yaml_object[yaml_object.keys[0]]
yaml_object = Helpers.normalize_yaml(yaml_object)
errors += validate_yaml_object('', yaml_object)
- if @options[:show_missing]
+ if @options.missing?
errors.concat find_missing_translations(yaml_object)
errors.concat find_missing_pluralizations(filename, yaml_object)
+ end
+
+ if @options.sanitize?
errors.concat find_unsanitized_html(filename, yaml_object)
end
errors.map { |err| "#{filename}: #{err}" }
end