y-rb 0.1.4.beta.1-x86_64-darwin → 0.1.5-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/yrb/Cargo.toml +3 -3
- data/ext/yrb/extconf.rb +1 -5
- data/ext/yrb/src/yxml_element.rs +9 -4
- data/lib/2.7/yrb.bundle +0 -0
- data/lib/3.0/yrb.bundle +0 -0
- data/lib/3.1/yrb.bundle +0 -0
- data/lib/y/version.rb +1 -1
- data/lib/y/xml.rb +31 -10
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baa39622df789b6766a52f8bdcaf44389ecc933f37e993ed12869e80b4506c63
|
4
|
+
data.tar.gz: 3efb2abf4c2a34c06295628acea7a15b7d97d980ecd6eff34e4b7b4f1b7f48a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ca56d4ec61701b9663cc75eadf7b28b56fdcdd4058f62d79469b4dd3a2d27cfe9074decc6989dedbf1f26cc37bf0a704e618ec4716812f9eeb2cd2a86e658d
|
7
|
+
data.tar.gz: '09a19c20d4ce791aeef5e63eaa6fe40d44dde660f309586e7264a7b605d05084c5b2ca96bbb656d0621c8f4098585e98b48a1e406f7377426420b661a7cb4d16'
|
data/ext/yrb/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "yrb"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.5"
|
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"
|
@@ -8,11 +8,11 @@ repository = "https://github.com/y-crdt/yrb"
|
|
8
8
|
|
9
9
|
[dependencies]
|
10
10
|
lib0 = "0.12.0" # must match yrs version
|
11
|
-
magnus = { git = "https://github.com/matsadler/magnus" } # waiting for release with full rb-sys backend
|
11
|
+
magnus = { git = "https://github.com/matsadler/magnus", rev = "cc852bfa31992d882d42509b1165eb5f67f9dc2c" } # waiting for release with full rb-sys backend
|
12
12
|
yrs = "0.12.0"
|
13
13
|
|
14
14
|
[dev-dependencies]
|
15
|
-
magnus = { git = "https://github.com/matsadler/magnus", features = ["embed"] } # waiting for release with full rb-sys backend
|
15
|
+
magnus = { git = "https://github.com/matsadler/magnus", rev = "cc852bfa31992d882d42509b1165eb5f67f9dc2c", features = ["embed"] } # waiting for release with full rb-sys backend
|
16
16
|
|
17
17
|
[lib]
|
18
18
|
name = "yrb"
|
data/ext/yrb/extconf.rb
CHANGED
data/ext/yrb/src/yxml_element.rs
CHANGED
@@ -49,21 +49,26 @@ impl YXmlElement {
|
|
49
49
|
transaction: &YTransaction,
|
50
50
|
index: u32,
|
51
51
|
name: String
|
52
|
-
) {
|
53
|
-
self.0.borrow_mut().insert_elem(
|
52
|
+
) -> YXmlElement {
|
53
|
+
let element = self.0.borrow_mut().insert_elem(
|
54
54
|
&mut *transaction.0.borrow_mut(),
|
55
55
|
index,
|
56
56
|
name
|
57
57
|
);
|
58
|
+
|
59
|
+
YXmlElement(RefCell::from(element))
|
58
60
|
}
|
59
61
|
pub(crate) fn yxml_element_insert_text(
|
60
62
|
&self,
|
61
63
|
transaction: &YTransaction,
|
62
64
|
index: u32
|
63
|
-
) {
|
64
|
-
self
|
65
|
+
) -> YXmlText {
|
66
|
+
let text = self
|
67
|
+
.0
|
65
68
|
.borrow_mut()
|
66
69
|
.insert_text(&mut *transaction.0.borrow_mut(), index);
|
70
|
+
|
71
|
+
YXmlText(RefCell::from(text))
|
67
72
|
}
|
68
73
|
pub(crate) fn yxml_element_next_sibling(&self) -> Option<Value> {
|
69
74
|
self.0.borrow().next_sibling().map(|item| match item {
|
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
|
data/lib/y/version.rb
CHANGED
data/lib/y/xml.rb
CHANGED
@@ -33,7 +33,9 @@ module Y
|
|
33
33
|
# @param [Integer] index
|
34
34
|
# @return [Y::XMLElement|nil]
|
35
35
|
def [](index)
|
36
|
-
yxml_element_get(index)
|
36
|
+
node = yxml_element_get(index)
|
37
|
+
node&.document = document
|
38
|
+
node
|
37
39
|
end
|
38
40
|
|
39
41
|
# Create a node at index
|
@@ -42,7 +44,9 @@ module Y
|
|
42
44
|
# @param [String] name Name of node, e.g. `<p />`
|
43
45
|
# @return [Y::XMLElement]
|
44
46
|
def []=(index, name)
|
45
|
-
yxml_element_insert_element(transaction, index, name)
|
47
|
+
node = yxml_element_insert_element(transaction, index, name)
|
48
|
+
node.document = document
|
49
|
+
node
|
46
50
|
end
|
47
51
|
|
48
52
|
# Returns first child in list or nil if no child exists
|
@@ -58,7 +62,9 @@ module Y
|
|
58
62
|
#
|
59
63
|
# @return [Y::XMLElement]
|
60
64
|
def first_child
|
61
|
-
yxml_element_first_child
|
65
|
+
child = yxml_element_first_child
|
66
|
+
child&.document = document
|
67
|
+
child
|
62
68
|
end
|
63
69
|
|
64
70
|
# Insert text into element at given index
|
@@ -70,6 +76,7 @@ module Y
|
|
70
76
|
# @return [Y::XMLText]
|
71
77
|
def insert_text(index, input = nil)
|
72
78
|
text = yxml_element_insert_text(transaction, index)
|
79
|
+
text.document = document
|
73
80
|
text << input unless input.nil?
|
74
81
|
text
|
75
82
|
end
|
@@ -78,7 +85,9 @@ module Y
|
|
78
85
|
#
|
79
86
|
# @return [Y::XMLElement|Y::XMLText|nil]
|
80
87
|
def next_sibling
|
81
|
-
yxml_element_next_sibling
|
88
|
+
node = yxml_element_next_sibling
|
89
|
+
node&.document = document
|
90
|
+
node
|
82
91
|
end
|
83
92
|
|
84
93
|
# Attach listener to get notified about changes to the element
|
@@ -108,14 +117,18 @@ module Y
|
|
108
117
|
#
|
109
118
|
# @return [Y::XMLElement|nil]
|
110
119
|
def parent
|
111
|
-
yxml_element_parent
|
120
|
+
node = yxml_element_parent
|
121
|
+
node.document = document
|
122
|
+
node
|
112
123
|
end
|
113
124
|
|
114
125
|
# Retrieve element or text adjacent (previous) to this element
|
115
126
|
#
|
116
127
|
# @return [Y::XMLElement|Y::XMLText|nil]
|
117
128
|
def prev_sibling
|
118
|
-
yxml_element_prev_sibling
|
129
|
+
node = yxml_element_prev_sibling
|
130
|
+
node&.document = document
|
131
|
+
node
|
119
132
|
end
|
120
133
|
|
121
134
|
# Creates a new child an inserts at the end of the children list
|
@@ -527,7 +540,7 @@ module Y
|
|
527
540
|
# - Hash (where the the types of key and values must be supported)
|
528
541
|
#
|
529
542
|
# @param [Integer] index
|
530
|
-
# @param [String, Float, Array, Hash] value
|
543
|
+
# @param [String, Float, Array, Hash, Boolean] value
|
531
544
|
# @param [Hash|nil] attrs
|
532
545
|
# @return [void]
|
533
546
|
def insert(index, value, attrs = nil)
|
@@ -537,6 +550,7 @@ module Y
|
|
537
550
|
yxml_text_insert_with_attrs(transaction, index, value,
|
538
551
|
attrs)
|
539
552
|
end
|
553
|
+
|
540
554
|
return nil
|
541
555
|
end
|
542
556
|
|
@@ -546,6 +560,7 @@ module Y
|
|
546
560
|
yxml_text_insert_embed_with_attrs(transaction, index, value,
|
547
561
|
attrs)
|
548
562
|
end
|
563
|
+
|
549
564
|
return nil
|
550
565
|
end
|
551
566
|
|
@@ -568,21 +583,27 @@ module Y
|
|
568
583
|
#
|
569
584
|
# @return [Y::XMLElement|Y::XMLText|nil]
|
570
585
|
def next_sibling
|
571
|
-
yxml_text_next_sibling
|
586
|
+
node = yxml_text_next_sibling
|
587
|
+
node.document = document
|
588
|
+
node
|
572
589
|
end
|
573
590
|
|
574
591
|
# Return parent XMLElement
|
575
592
|
#
|
576
593
|
# @return [Y::XMLElement|nil]
|
577
594
|
def parent
|
578
|
-
yxml_text_parent
|
595
|
+
node = yxml_text_parent
|
596
|
+
node.document = document
|
597
|
+
node
|
579
598
|
end
|
580
599
|
|
581
600
|
# Return adjacent XMLElement or XMLText node (prev)
|
582
601
|
#
|
583
602
|
# @return [Y::XMLElement|Y::XMLText|nil]
|
584
603
|
def prev_sibling
|
585
|
-
yxml_text_prev_sibling
|
604
|
+
node = yxml_text_prev_sibling
|
605
|
+
node&.document = document
|
606
|
+
node
|
586
607
|
end
|
587
608
|
|
588
609
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
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.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Hannes Moser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.31
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.
|
40
|
+
version: 0.9.31
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,9 +122,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: 3.2.dev
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- - "
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
127
|
+
version: 3.3.21
|
128
128
|
requirements: []
|
129
129
|
rubygems_version: 3.4.0.dev
|
130
130
|
signing_key:
|