colordom 0.9.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5c8de04d1de01b313514ca8971f57b4050125165d3966c1c9bd5e3e26c978ec
4
- data.tar.gz: b0c2eb60501eeaf6b232dd2401961a006bad283dabf669ab6954230dc0aebefb
3
+ metadata.gz: 4d4eda839bf50d6aff4cbd90d41dd831a8d3046e8cc9b304289a206efbbf5e21
4
+ data.tar.gz: 9d4193855a4d1f4ff25db136905065b93650839dc744e08ee38b5efa1ae69b25
5
5
  SHA512:
6
- metadata.gz: c2e2e2465599fc75642c82a1fa568cd757b17ef63a8057dbe1a26d67732e04dc65ea58a190e763e168a97d1aaee570eb46536590341c5bca2c1bca50bfd432d9
7
- data.tar.gz: 05e690df2658a015342ce12446bee56c028133d94afdf67469e08ff5349958f00852fb32541fc01beac4ef2316c751dd1027c94c66110c85d3015796088179bb
6
+ metadata.gz: 01cf25d70191c3035fdc0f82fec4aa26d3016daa61ffc7c915c35d19b95c957fc33f6c94aed28a8db9b7b25e6eac57785fa7ffa4ff195809064395083ebc20c7
7
+ data.tar.gz: 4f7ba672b294f2f2679611e6cec332143f366d71ef9f72bdc1c2500bc49b783fa673cb3ee10d1671009339eaef9282b45e45c5431631ce82a7cefa6d64239036
@@ -6,7 +6,7 @@ edition = "2018"
6
6
 
7
7
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
  [dependencies]
9
- magnus = "0.5"
9
+ magnus = "0.7"
10
10
  image = "0.24"
11
11
  dominant_color = "0.3"
12
12
  palette_extract = "0.1"
@@ -1,8 +1,7 @@
1
1
  use std::path::PathBuf;
2
2
 
3
3
  use magnus::{
4
- class, define_module, function, method,
5
- prelude::*, gc::register_mark_object, memoize,
4
+ function, method, prelude::*, value::Lazy, Ruby,
6
5
  Error, ExceptionClass, RModule, IntoValueFromNative
7
6
  };
8
7
 
@@ -10,12 +9,14 @@ use image::{DynamicImage};
10
9
  use palette_extract::{Quality, MaxColors, PixelEncoding, PixelFilter};
11
10
  use palette::{FromColor, IntoColor, Lab, Pixel, Srgb};
12
11
 
12
+ static MODULE: Lazy<RModule> =
13
+ Lazy::new(|ruby| ruby.class_object().const_get("Colordom").unwrap());
14
+
15
+ static ERROR: Lazy<ExceptionClass> =
16
+ Lazy::new(|ruby| ruby.get_inner(&MODULE).const_get("Error").unwrap());
17
+
13
18
  fn colordom_error() -> ExceptionClass {
14
- *memoize!(ExceptionClass: {
15
- let ex = class::object().const_get::<_, RModule>("Colordom").unwrap().const_get("Error").unwrap();
16
- register_mark_object(ex);
17
- ex
18
- })
19
+ Ruby::get().unwrap().get_inner(&ERROR)
19
20
  }
20
21
 
21
22
  macro_rules! error {
@@ -129,10 +130,10 @@ impl Image {
129
130
  }
130
131
 
131
132
  #[magnus::init]
132
- fn init() -> Result<(), Error> {
133
- let module = define_module("Colordom")?;
133
+ fn init(ruby: &Ruby) -> Result<(), Error> {
134
+ let module = ruby.define_module("Colordom")?;
134
135
 
135
- let colorc = module.define_class("Color", class::object())?;
136
+ let colorc = module.define_class("Color", ruby.class_object())?;
136
137
 
137
138
  colorc.define_singleton_method("new", function!(Color::new, 3))?;
138
139
  colorc.define_method("r", method!(Color::r, 0))?;
@@ -148,7 +149,7 @@ fn init() -> Result<(), Error> {
148
149
  colorc.define_alias("to_rgb", "rgb")?;
149
150
  colorc.define_alias("to_hex", "hex")?;
150
151
 
151
- let imagec = module.define_class("Image", class::object())?;
152
+ let imagec = module.define_class("Image", ruby.class_object())?;
152
153
 
153
154
  imagec.define_singleton_method("new", function!(Image::new, 1))?;
154
155
  imagec.define_method("histogram", method!(Image::histogram, 1))?;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Colordom
4
- VERSION = '0.9.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colordom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: '2.6'
101
+ version: '2.7'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ">="