File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -97,5 +97,9 @@ fn init(ruby: &Ruby) -> Result<(), magnus::Error> {
9797 class. define_method ( "valid?" , method ! ( Validator :: is_valid, 1 ) ) ?;
9898 class. define_method ( "validate" , method ! ( Validator :: validate, 1 ) ) ?;
9999
100+ // Ensure defined at load time
101+ Lazy :: force ( & JSON_PARSE_ERROR , ruby) ;
102+ Lazy :: force ( & SCHEMA_PARSE_ERROR , ruby) ;
103+
100104 Ok ( ( ) )
101105}
Original file line number Diff line number Diff line change 22
33require_relative "rust_json_schema/version"
44
5- # Tries to require the extension for the given Ruby version first
6- begin
7- RUBY_VERSION =~ /(\d +\. \d +)/
8- require "rust_json_schema/#{ Regexp . last_match ( 1 ) } /rust_json_schema"
9- rescue LoadError
10- require_relative "rust_json_schema/rust_json_schema"
11- end
12-
135module RustJSONSchema
146 class Error < StandardError ; end
157
168 class JSONParseError < Error ; end
179
1810 class SchemaParseError < Error ; end
1911end
12+
13+ # Tries to require the extension for the given Ruby version first
14+ begin
15+ RUBY_VERSION =~ /(\d +\. \d +)/
16+ require "rust_json_schema/#{ Regexp . last_match ( 1 ) } /rust_json_schema"
17+ rescue LoadError
18+ require_relative "rust_json_schema/rust_json_schema"
19+ end
You can’t perform that action at this time.
0 commit comments