diff --git a/lib/rggen/core/input_base/yaml_loader.rb b/lib/rggen/core/input_base/yaml_loader.rb index 2bc109e..dde832d 100644 --- a/lib/rggen/core/input_base/yaml_loader.rb +++ b/lib/rggen/core/input_base/yaml_loader.rb @@ -49,10 +49,8 @@ def mapping_key? end class Visitor < ::Psych::Visitors::ToRuby - if ::Psych::VERSION >= '3.2.0' - def initialize(scalar_scanner, class_loader) - super(scalar_scanner, class_loader, symbolize_names: true) - end + def initialize(scalar_scanner, class_loader) + super(scalar_scanner, class_loader, symbolize_names: true) end def accept(node) @@ -79,7 +77,6 @@ def override_object?(node) def load_yaml(file) parse_yaml(File.binread(file), file) .then { |result| to_ruby(result) } - .then { |result| symbolize_names(result) } end def parse_yaml(yaml, file) @@ -93,20 +90,6 @@ def to_ruby(result) ss = ::Psych::ScalarScanner.new(cl) Visitor.new(ss, cl).accept(result) end - - def symbolize_names(result) - return result if ::Psych::VERSION >= '3.2.0' - - if result.match_class?(Hash) - result - .transform_keys!(&:to_sym) - .transform_values!(&method(:symbolize_names)) - elsif result.match_class?(Array) - result.map! { |value| symbolize_names(value) } - end - - result - end end end end