From 43c13537dfbd5fa813055cf4db73610ccf3c85a6 Mon Sep 17 00:00:00 2001 From: Roberto Ripamonti Date: Fri, 2 Aug 2024 19:44:41 +0200 Subject: [PATCH] Fix snakecase `NoMethodError` (#347) --- lib/winrm/psrp/message_data/base.rb | 2 +- lib/winrm/wsmv/wql_pull.rb | 2 +- lib/winrm/wsmv/wql_query.rb | 2 +- winrm.gemspec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/winrm/psrp/message_data/base.rb b/lib/winrm/psrp/message_data/base.rb index 5378fc5f..9d382de4 100644 --- a/lib/winrm/psrp/message_data/base.rb +++ b/lib/winrm/psrp/message_data/base.rb @@ -35,7 +35,7 @@ def clixml parser = Nori.new( parser: :rexml, advanced_typecasting: false, - convert_tags_to: ->(tag) { tag.snakecase.to_sym }, + convert_tags_to: ->(tag) { Nori::StringUtils.snakecase(tag).to_sym }, strip_namespaces: true ) parser.parse(raw)[:obj][:ms] diff --git a/lib/winrm/wsmv/wql_pull.rb b/lib/winrm/wsmv/wql_pull.rb index b1196edf..a20f520d 100644 --- a/lib/winrm/wsmv/wql_pull.rb +++ b/lib/winrm/wsmv/wql_pull.rb @@ -15,7 +15,7 @@ def process_response(response) parser = Nori.new( parser: :rexml, advanced_typecasting: false, - convert_tags_to: ->(tag) { tag.snakecase.to_sym }, + convert_tags_to: ->(tag) { Nori::StringUtils.snakecase(tag).to_sym }, strip_namespaces: true ) parser.parse(response.to_s)[:envelope][:body] diff --git a/lib/winrm/wsmv/wql_query.rb b/lib/winrm/wsmv/wql_query.rb index 2c937936..6974a4a2 100644 --- a/lib/winrm/wsmv/wql_query.rb +++ b/lib/winrm/wsmv/wql_query.rb @@ -30,7 +30,7 @@ def process_response(response, &block) parser = Nori.new( parser: :rexml, advanced_typecasting: false, - convert_tags_to: ->(tag) { tag.snakecase.to_sym }, + convert_tags_to: ->(tag) { Nori::StringUtils.snakecase(tag).to_sym }, strip_namespaces: true ) @items = Hash.new { |h, k| h[k] = [] } diff --git a/winrm.gemspec b/winrm.gemspec index 9e6806a4..fed474ea 100644 --- a/winrm.gemspec +++ b/winrm.gemspec @@ -36,7 +36,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'gyoku', '~> 1.0' s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2' s.add_runtime_dependency 'logging', ['>= 1.6.1', '< 3.0'] - s.add_runtime_dependency 'nori', '~> 2.0' + s.add_runtime_dependency 'nori', '~> 2.0', '>= 2.7.1' s.add_runtime_dependency 'rexml', '~> 3.0' s.add_development_dependency 'pry' s.add_development_dependency 'rake', '>= 10.3', '< 13'