y-rb 0.4.2-arm64-darwin → 0.4.4-arm64-darwin

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: 471e24956dba5d6e52d09a4b8357a3d04f56bbc7d72736e21edb2f50bbd6f2dd
4
- data.tar.gz: 7167ddc78214e95fa6eaefc7a9a6d45af1afeddcb88e1d1d66a0d19b5c569952
3
+ metadata.gz: 94479f4beaa4c8d615afc8779b856a82827e2a292004dc61e1969da3254c49dc
4
+ data.tar.gz: ca5ff6fef5191eeec60177fa22e8d061f87673845c0623ea2b3723238302dcb8
5
5
  SHA512:
6
- metadata.gz: f521487258f7c89f6f9064c89d52e37c711ad8cace76efab7f4ef0cb95e2834ed9fa84e38af73c20075757d518269937de93677815955bca104cd4c36619b87f
7
- data.tar.gz: 16b4921a1f563dd1310d11cb4a0f9a4f5768ec848e421a9ef586ccd630398d8faa1f327c644b8998774a440f74178cab1f3bd5baae7dabb2d719cd5c4b600bbf
6
+ metadata.gz: 070a4af377f24372a5d2bff9bc76c161f9dcab63eee71bd32a917868b51255cd7f5c9f16656a4c1f13f37f3b017327dd02e518a4a80cbbd0fb0d63a83ce59f28
7
+ data.tar.gz: 49e96cb13a47e59544972f18201089b13939f23a92152b2db02bfe132d99643f067e9a09a5143327270866b034ce0b12178688abedaa1fc4e0d347e1d2d0e8b7
data/ext/yrb/Cargo.toml CHANGED
@@ -1,19 +1,19 @@
1
1
  [package]
2
2
  name = "yrb"
3
- version = "0.4.2"
3
+ version = "0.4.4"
4
4
  authors = ["Hannes Moser <box@hannesmoser.at>", "Hannes Moser <hmoser@gitlab.com>"]
5
5
  edition = "2021"
6
6
  homepage = "https://github.com/y-crdt/yrb"
7
7
  repository = "https://github.com/y-crdt/yrb"
8
8
 
9
9
  [dependencies]
10
- lib0 = "0.14.1" # must match yrs version
11
- magnus = { git = "https://github.com/matsadler/magnus", rev = "a51ccaf01d82e9e1a981e4f3fbaca35100513b08" }
10
+ lib0 = "0.16.0" # must match yrs version
11
+ magnus = { git = "https://github.com/matsadler/magnus", rev = "ab982c3643421b38f3293f1fe014aa373abfd6dc" }
12
12
  thiserror = "1.0.38"
13
- yrs = "0.14.1"
13
+ yrs = "0.16.0"
14
14
 
15
15
  [dev-dependencies]
16
- magnus = { git = "https://github.com/matsadler/magnus", rev = "a51ccaf01d82e9e1a981e4f3fbaca35100513b08", features = ["embed"] }
16
+ magnus = { git = "https://github.com/matsadler/magnus", rev = "ab982c3643421b38f3293f1fe014aa373abfd6dc", features = ["embed"] }
17
17
 
18
18
  [lib]
19
19
  name = "yrb"
data/ext/yrb/src/yany.rs CHANGED
@@ -1,4 +1,5 @@
1
1
  use lib0::any::Any;
2
+ use magnus::r_string::IntoRString;
2
3
  use magnus::{RArray, RHash, RString, Value, QNIL};
3
4
  use std::borrow::Borrow;
4
5
  use std::ops::{Deref, DerefMut};
@@ -37,7 +38,7 @@ impl TryInto<Value> for YAny {
37
38
  Any::Bool(v) => Ok(Value::from(v)),
38
39
  Any::Number(v) => Ok(Value::from(v)),
39
40
  Any::BigInt(v) => Ok(Value::from(v)),
40
- Any::String(v) => Ok(Value::from(RString::from(v.borrow()))),
41
+ Any::String(v) => Ok(Value::from(RString::from(v.into_r_string()))),
41
42
  Any::Buffer(v) => Ok(Value::from(RString::from_slice(v.borrow()))),
42
43
  };
43
44
  }
@@ -4,6 +4,7 @@ use lib0::any::Any;
4
4
  use magnus::block::Proc;
5
5
  use magnus::value::Qnil;
6
6
  use magnus::{Error, RArray, RHash, Symbol, Value};
7
+ use std::borrow::Borrow;
7
8
  use std::cell::RefCell;
8
9
  use yrs::types::Change;
9
10
  use yrs::{Array, ArrayRef, Observable};
@@ -112,9 +113,15 @@ impl YArray {
112
113
  .partition(Result::is_ok);
113
114
 
114
115
  if errors.is_empty() {
115
- let args = (RArray::from_vec(
116
- changes.into_iter().map(Result::unwrap).collect(),
117
- ),);
116
+ let args_changes = RArray::new();
117
+ for change in changes.iter() {
118
+ let c = *change.borrow().as_ref().unwrap();
119
+ args_changes
120
+ .push(c)
121
+ .expect("cannot push change event to args");
122
+ }
123
+
124
+ let args = (args_changes,);
118
125
  let _ = block.call::<(RArray,), Qnil>(args);
119
126
  // todo: make sure we respect the result and bubble up the
120
127
  // error so that we can return as part of the Result
@@ -143,7 +150,7 @@ impl YArray {
143
150
  let tx = tx.as_mut().unwrap();
144
151
 
145
152
  let arr = self.0.borrow_mut();
146
- arr.push_front(tx, avalue)
153
+ arr.push_front(tx, avalue);
147
154
  }
148
155
  pub(crate) fn yarray_remove(&self, transaction: &YTransaction, index: u32) {
149
156
  let mut tx = transaction.transaction();
@@ -164,12 +171,13 @@ impl YArray {
164
171
  let tx = transaction.transaction();
165
172
  let tx = tx.as_ref().unwrap();
166
173
 
167
- let arr = arr
168
- .iter(tx)
169
- .map(|v| YValue::from(v).into())
170
- .collect::<Vec<Value>>();
171
-
172
- RArray::from_vec(arr)
174
+ let r_arr = RArray::new();
175
+ for item in arr.iter(tx) {
176
+ let r_val = YValue::from(item);
177
+ let r_val = r_val.0.borrow().clone();
178
+ r_arr.push(r_val).expect("cannot push item event to array");
179
+ }
180
+ r_arr
173
181
  }
174
182
  pub(crate) fn yarray_unobserve(&self, subscription_id: u32) {
175
183
  self.0.borrow_mut().unobserve(subscription_id);
data/ext/yrb/src/ymap.rs CHANGED
@@ -27,7 +27,7 @@ impl YMap {
27
27
 
28
28
  match indifferent_hash_key(key) {
29
29
  None => false,
30
- Some(k) => self.0.borrow().contains(tx, k.as_str()),
30
+ Some(k) => self.0.borrow().contains_key(tx, k.as_str()),
31
31
  }
32
32
  }
33
33
  pub(crate) fn ymap_each(&self, transaction: &YTransaction, proc: Proc) {
data/ext/yrb/src/ytext.rs CHANGED
@@ -48,7 +48,7 @@ impl YText {
48
48
  let yvalue = YValue::from(content);
49
49
  let avalue = Any::from(yvalue);
50
50
 
51
- self.0.borrow_mut().insert_embed(tx, index, avalue)
51
+ self.0.borrow_mut().insert_embed(tx, index, avalue);
52
52
  }
53
53
  pub(crate) fn ytext_insert_embed_with_attributes(
54
54
  &self,
@@ -67,7 +67,7 @@ impl YText {
67
67
 
68
68
  self.0
69
69
  .borrow_mut()
70
- .insert_embed_with_attributes(tx, index, avalue, a.0)
70
+ .insert_embed_with_attributes(tx, index, avalue, a.0);
71
71
  }
72
72
  pub(crate) fn ytext_insert_with_attributes(
73
73
  &self,
@@ -116,12 +116,13 @@ impl From<Any> for YValue {
116
116
  Any::String(v) => YValue::from(v.into_string()),
117
117
  Any::Buffer(v) => YValue::from(Value::from(v.into_vec())),
118
118
  Any::Array(v) => {
119
- let arr = v
120
- .iter()
121
- .map(|i| YValue::from(i.clone()))
122
- .map(|value| *value.0.borrow())
123
- .collect::<Vec<Value>>();
124
- YValue::from(RArray::from_vec(arr))
119
+ let arr = RArray::new();
120
+ for item in v.iter() {
121
+ let val = YValue::from(item.clone());
122
+ let val = val.0.borrow().clone();
123
+ arr.push(val).expect("cannot push item event to array");
124
+ }
125
+ YValue::from(arr)
125
126
  }
126
127
  Any::Map(v) => {
127
128
  let map = v
@@ -146,14 +147,12 @@ impl From<YrsValue> for YValue {
146
147
  YrsValue::YXmlText(text) => YValue::from(text),
147
148
  YrsValue::YArray(val) => {
148
149
  let tx = val.transact();
149
- let arr = RArray::from_vec(
150
- val.iter(&tx)
151
- .map(|item| {
152
- let yvalue = YValue::from(item);
153
- yvalue.0.into_inner()
154
- })
155
- .collect(),
156
- );
150
+ let arr = RArray::new();
151
+ for item in val.iter(&tx) {
152
+ let val = YValue::from(item.clone());
153
+ let val = val.0.borrow().clone();
154
+ arr.push(val).expect("cannot push item event to array");
155
+ }
157
156
  YValue::from(arr)
158
157
  }
159
158
  YrsValue::YMap(val) => {
@@ -76,7 +76,7 @@ impl YXmlElement {
76
76
  index: u32,
77
77
  content: String,
78
78
  ) -> YXmlText {
79
- let text = XmlTextPrelim(content.as_str());
79
+ let text = XmlTextPrelim::new(content.as_str());
80
80
  let mut tx = transaction.transaction();
81
81
  let tx = tx.as_mut().unwrap();
82
82
 
@@ -107,15 +107,16 @@ impl YXmlElement {
107
107
  for change in delta {
108
108
  match change {
109
109
  Change::Added(v) => {
110
- let values = v
111
- .iter()
112
- .map(|o| YValue::from(o.clone()))
113
- .map(|o| *o.0.borrow())
114
- .collect::<Vec<_>>();
110
+ let values = RArray::new();
111
+ for value in v.iter() {
112
+ let value = YValue::from(value.clone());
113
+ let value = value.0.borrow().clone();
114
+ values.push(value).expect("cannot push value to array");
115
+ }
115
116
 
116
117
  let payload = RHash::new();
117
118
  payload
118
- .aset(change_added, RArray::from_vec(values))
119
+ .aset(change_added, values)
119
120
  .expect("cannot create change::added payload");
120
121
 
121
122
  changes
@@ -203,7 +204,7 @@ impl YXmlElement {
203
204
  let mut tx = transaction.transaction();
204
205
  let tx = tx.as_mut().unwrap();
205
206
 
206
- let text = XmlTextPrelim(content.as_str());
207
+ let text = XmlTextPrelim::new(content.as_str());
207
208
  YXmlText::from(self.0.borrow_mut().push_back(tx, text))
208
209
  }
209
210
  pub(crate) fn yxml_element_push_text_front(
@@ -214,7 +215,7 @@ impl YXmlElement {
214
215
  let mut tx = transaction.transaction();
215
216
  let tx = tx.as_mut().unwrap();
216
217
 
217
- let text = XmlTextPrelim(content.as_str());
218
+ let text = XmlTextPrelim::new(content.as_str());
218
219
  YXmlText::from(self.0.borrow_mut().push_front(tx, text))
219
220
  }
220
221
  pub(crate) fn yxml_element_remove_attribute(&self, transaction: &YTransaction, name: String) {
@@ -72,11 +72,13 @@ impl YXmlText {
72
72
  let yvalue = YValue::from(content);
73
73
  let avalue = Any::from(yvalue);
74
74
 
75
- map_rhash_to_attrs(attrs).map(|a| {
76
- self.0
77
- .borrow_mut()
78
- .insert_embed_with_attributes(tx, index, avalue, a)
79
- })
75
+ map_rhash_to_attrs(attrs)
76
+ .map(|a| {
77
+ self.0
78
+ .borrow_mut()
79
+ .insert_embed_with_attributes(tx, index, avalue, a)
80
+ })
81
+ .map(|_| ())
80
82
  }
81
83
  pub(crate) fn yxml_text_insert_embed(
82
84
  &self,
@@ -89,7 +91,7 @@ impl YXmlText {
89
91
 
90
92
  self.0
91
93
  .borrow_mut()
92
- .insert_embed(tx, index, Any::from(YValue::from(embed)))
94
+ .insert_embed(tx, index, Any::from(YValue::from(embed)));
93
95
  }
94
96
  pub(crate) fn yxml_text_insert_with_attributes(
95
97
  &self,
data/lib/2.7/yrb.bundle CHANGED
Binary file
data/lib/3.0/yrb.bundle CHANGED
Binary file
data/lib/3.1/yrb.bundle CHANGED
Binary file
Binary file
data/lib/y/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Y
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Hannes Moser
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,48 +24,50 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '13.0'
27
+ force_ruby_platform: false
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rb_sys
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
- version: 0.9.53
34
+ version: 0.9.56
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: 0.9.53
41
+ version: 0.9.56
42
+ force_ruby_platform: false
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: rake-compiler
43
45
  requirement: !ruby/object:Gem::Requirement
44
46
  requirements:
45
47
  - - "~>"
46
48
  - !ruby/object:Gem::Version
47
- version: 1.2.0
49
+ version: 1.2.1
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - "~>"
53
55
  - !ruby/object:Gem::Version
54
- version: 1.2.0
56
+ version: 1.2.1
55
57
  - !ruby/object:Gem::Dependency
56
58
  name: rake-compiler-dock
57
59
  requirement: !ruby/object:Gem::Requirement
58
60
  requirements:
59
61
  - - "~>"
60
62
  - !ruby/object:Gem::Version
61
- version: 1.2.2
63
+ version: 1.3.0
62
64
  type: :development
63
65
  prerelease: false
64
66
  version_requirements: !ruby/object:Gem::Requirement
65
67
  requirements:
66
68
  - - "~>"
67
69
  - !ruby/object:Gem::Version
68
- version: 1.2.2
70
+ version: 1.3.0
69
71
  description: Ruby bindings for yrs. Yrs "wires" is a Rust port of the Yjs framework.
70
72
  email:
71
73
  - hmoser@gitlab.com
@@ -94,6 +96,7 @@ files:
94
96
  - lib/2.7/yrb.bundle
95
97
  - lib/3.0/yrb.bundle
96
98
  - lib/3.1/yrb.bundle
99
+ - lib/3.2/yrb.bundle
97
100
  - lib/y-rb.rb
98
101
  - lib/y.rb
99
102
  - lib/y/array.rb
@@ -113,7 +116,7 @@ metadata:
113
116
  source_code_uri: https://github.com/y-crdt/yrb
114
117
  documentation_uri: https://y-crdt.github.io/yrb/
115
118
  rubygems_mfa_required: 'true'
116
- post_install_message:
119
+ post_install_message:
117
120
  rdoc_options: []
118
121
  require_paths:
119
122
  - lib
@@ -124,15 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
127
  version: '2.7'
125
128
  - - "<"
126
129
  - !ruby/object:Gem::Version
127
- version: 3.2.dev
130
+ version: 3.3.dev
128
131
  required_rubygems_version: !ruby/object:Gem::Requirement
129
132
  requirements:
130
133
  - - ">="
131
134
  - !ruby/object:Gem::Version
132
135
  version: 3.3.21
133
136
  requirements: []
134
- rubygems_version: 3.3.22
135
- signing_key:
137
+ rubygems_version: 3.4.4
138
+ signing_key:
136
139
  specification_version: 4
137
140
  summary: Ruby bindings for yrs
138
141
  test_files: []