From 6a05d5ed17b7bc3e9fefc6029e0e8e17d180fb59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:23:00 +0000 Subject: [PATCH 1/3] Update quick-xml requirement from 0.36 to 0.38 in /ext/parsekit Updates the requirements on [quick-xml](https://github.com/tafia/quick-xml) to permit the latest version. - [Release notes](https://github.com/tafia/quick-xml/releases) - [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md) - [Commits](https://github.com/tafia/quick-xml/compare/v0.36.0...v0.38.2) --- updated-dependencies: - dependency-name: quick-xml dependency-version: 0.38.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- ext/parsekit/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/parsekit/Cargo.toml b/ext/parsekit/Cargo.toml index 761b600..a91a443 100644 --- a/ext/parsekit/Cargo.toml +++ b/ext/parsekit/Cargo.toml @@ -20,7 +20,7 @@ tesseract-rs = "0.1" # Tesseract with optional bundling image = "0.25" # Image processing library (match rusty-tesseract's version) calamine = "0.30" # Excel parsing docx-rs = "0.4" # Word document parsing -quick-xml = "0.36" # XML parsing +quick-xml = "0.38" # XML parsing serde_json = "1.0" # JSON parsing regex = "1.10" # Text parsing encoding_rs = "0.8" # Encoding detection From 6851a4cc89aa595e70e777b9ef3def074c76a5f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:23:00 +0000 Subject: [PATCH 2/3] Update quick-xml requirement from 0.36 to 0.38 in /ext/parsekit Updates the requirements on [quick-xml](https://github.com/tafia/quick-xml) to permit the latest version. - [Release notes](https://github.com/tafia/quick-xml/releases) - [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md) - [Commits](https://github.com/tafia/quick-xml/compare/v0.36.0...v0.38.2) --- updated-dependencies: - dependency-name: quick-xml dependency-version: 0.38.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- ext/parsekit/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/parsekit/Cargo.toml b/ext/parsekit/Cargo.toml index 8bf5ed6..3011107 100644 --- a/ext/parsekit/Cargo.toml +++ b/ext/parsekit/Cargo.toml @@ -33,4 +33,4 @@ bundled-tesseract = [] [profile.release] opt-level = 3 lto = true -codegen-units = 1 \ No newline at end of file +codegen-units = 1 From d3bdd8705cb8140f9e9c6b27d28e8b3d388722cc Mon Sep 17 00:00:00 2001 From: Chris Petersen Date: Fri, 5 Sep 2025 19:18:11 -0700 Subject: [PATCH 3/3] Fixed some deprecation warnings --- ext/parsekit/src/error.rs | 14 +++++++------- ext/parsekit/src/parser.rs | 36 ++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ext/parsekit/src/error.rs b/ext/parsekit/src/error.rs index d0d1e50..ee35ba1 100644 --- a/ext/parsekit/src/error.rs +++ b/ext/parsekit/src/error.rs @@ -1,4 +1,4 @@ -use magnus::{exception, Error, RModule, Ruby, Module}; +use magnus::{Error, RModule, Ruby, Module}; /// Custom error types for ParseKit #[derive(Debug)] @@ -15,13 +15,13 @@ impl ParserError { pub fn to_error(&self) -> Error { match self { ParserError::ParseError(msg) => { - Error::new(exception::runtime_error(), msg.clone()) + Error::new(Ruby::get().unwrap().exception_runtime_error(), msg.clone()) } ParserError::ConfigError(msg) => { - Error::new(exception::arg_error(), msg.clone()) + Error::new(Ruby::get().unwrap().exception_arg_error(), msg.clone()) } ParserError::IoError(msg) => { - Error::new(exception::io_error(), msg.clone()) + Error::new(Ruby::get().unwrap().exception_io_error(), msg.clone()) } } } @@ -37,9 +37,9 @@ pub fn init(_ruby: &Ruby, module: RModule) -> Result<(), Error> { // Define error classes as regular Ruby classes // Users can still rescue them by name in Ruby code - let _error = module.define_class("Error", magnus::class::object())?; - let _parse_error = module.define_class("ParseError", magnus::class::object())?; - let _config_error = module.define_class("ConfigError", magnus::class::object())?; + let _error = module.define_class("Error", Ruby::get().unwrap().class_object())?; + let _parse_error = module.define_class("ParseError", Ruby::get().unwrap().class_object())?; + let _config_error = module.define_class("ConfigError", Ruby::get().unwrap().class_object())?; Ok(()) } \ No newline at end of file diff --git a/ext/parsekit/src/parser.rs b/ext/parsekit/src/parser.rs index 6048c5c..652c9b6 100644 --- a/ext/parsekit/src/parser.rs +++ b/ext/parsekit/src/parser.rs @@ -1,5 +1,5 @@ use magnus::{ - class, function, method, prelude::*, scan_args, Error, Module, RHash, RModule, Ruby, Value, + function, method, prelude::*, scan_args, Error, Module, RHash, RModule, Ruby, Value, }; use std::path::Path; @@ -59,7 +59,7 @@ impl Parser { // Check size limit if data.len() > self.config.max_size { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!( "File size {} exceeds maximum allowed size {}", data.len(), @@ -192,7 +192,7 @@ impl Parser { if let Err(e) = init_result { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to initialize Tesseract: {:?}", e), )) } @@ -201,7 +201,7 @@ impl Parser { let img = match image::load_from_memory(&data) { Ok(img) => img, Err(e) => return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to load image: {}", e), )) }; @@ -220,7 +220,7 @@ impl Parser { (width * 4) as i32, // bytes per line ) { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to set image: {}", e), )) } @@ -229,7 +229,7 @@ impl Parser { match tesseract.get_utf8_text() { Ok(text) => Ok(text.trim().to_string()), Err(e) => Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to perform OCR: {}", e), )), } @@ -251,7 +251,7 @@ impl Parser { Ok(count) => count, Err(e) => { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to get page count: {}", e), )) } @@ -284,7 +284,7 @@ impl Parser { } } Err(e) => Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to parse PDF: {}", e), )), } @@ -323,7 +323,7 @@ impl Parser { Ok(result.trim().to_string()) } Err(e) => Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to parse DOCX file: {}", e), )), } @@ -339,7 +339,7 @@ impl Parser { Ok(archive) => archive, Err(e) => { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to open PPTX as ZIP: {}", e), )) } @@ -441,7 +441,7 @@ impl Parser { } Ok(Event::Text(e)) => { if in_text_element { - if let Ok(text) = e.unescape() { + if let Ok(text) = e.decode() { let text_str = text.trim(); if !text_str.is_empty() { text_parts.push(text_str.to_string()); @@ -493,7 +493,7 @@ impl Parser { Ok(result) } Err(e) => Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("Failed to parse Excel file: {}", e), )), } @@ -522,13 +522,13 @@ impl Parser { loop { match reader.read_event_into(&mut buf) { Ok(Event::Text(e)) => { - txt.push_str(&e.unescape().unwrap_or_default()); + txt.push_str(&e.decode().unwrap_or_default()); txt.push(' '); } Ok(Event::Eof) => break, Err(e) => { return Err(Error::new( - magnus::exception::runtime_error(), + Ruby::get().unwrap().exception_runtime_error(), format!("XML parse error: {}", e), )) } @@ -558,7 +558,7 @@ impl Parser { fn parse(&self, input: String) -> Result { if input.is_empty() { return Err(Error::new( - magnus::exception::arg_error(), + Ruby::get().unwrap().exception_arg_error(), "Input cannot be empty", )); } @@ -578,7 +578,7 @@ impl Parser { let data = fs::read(&path).map_err(|e| { Error::new( - magnus::exception::io_error(), + Ruby::get().unwrap().exception_io_error(), format!("Failed to read file: {}", e), ) })?; @@ -590,7 +590,7 @@ impl Parser { fn parse_bytes(&self, data: Vec) -> Result { if data.is_empty() { return Err(Error::new( - magnus::exception::arg_error(), + Ruby::get().unwrap().exception_arg_error(), "Data cannot be empty", )); } @@ -668,7 +668,7 @@ fn parse_bytes_direct(data: Vec) -> Result { /// Initialize the Parser class pub fn init(_ruby: &Ruby, module: RModule) -> Result<(), Error> { - let class = module.define_class("Parser", class::object())?; + let class = module.define_class("Parser", Ruby::get().unwrap().class_object())?; // Instance methods class.define_singleton_method("new", function!(Parser::new, -1))?;