y-rb 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,45 +23,39 @@ impl YXmlElement {
23
23
  pub(crate) fn yxml_element_get(&self, index: u32) -> Option<Value> {
24
24
  self.0.borrow().get(index).map(|node| match node {
25
25
  Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
26
- Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
26
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text))),
27
27
  })
28
28
  }
29
- pub(crate) fn yxml_element_get_attribute(
30
- &self,
31
- name: String
32
- ) -> Option<String> {
29
+ pub(crate) fn yxml_element_get_attribute(&self, name: String) -> Option<String> {
33
30
  self.0.borrow().get_attribute(&*name)
34
31
  }
35
32
  pub(crate) fn yxml_element_insert_attribute(
36
33
  &self,
37
34
  transaction: &YTransaction,
38
35
  name: String,
39
- value: String
36
+ value: String,
40
37
  ) {
41
- self.0.borrow_mut().insert_attribute(
42
- &mut *transaction.0.borrow_mut(),
43
- name,
44
- value
45
- );
38
+ self.0
39
+ .borrow_mut()
40
+ .insert_attribute(&mut *transaction.0.borrow_mut(), name, value);
46
41
  }
47
42
  pub(crate) fn yxml_element_insert_element(
48
43
  &self,
49
44
  transaction: &YTransaction,
50
45
  index: u32,
51
- name: String
46
+ name: String,
52
47
  ) -> YXmlElement {
53
- let element = self.0.borrow_mut().insert_elem(
54
- &mut *transaction.0.borrow_mut(),
55
- index,
56
- name
57
- );
48
+ let element =
49
+ self.0
50
+ .borrow_mut()
51
+ .insert_elem(&mut *transaction.0.borrow_mut(), index, name);
58
52
 
59
53
  YXmlElement(RefCell::from(element))
60
54
  }
61
55
  pub(crate) fn yxml_element_insert_text(
62
56
  &self,
63
57
  transaction: &YTransaction,
64
- index: u32
58
+ index: u32,
65
59
  ) -> YXmlText {
66
60
  let text = self
67
61
  .0
@@ -73,19 +67,18 @@ impl YXmlElement {
73
67
  pub(crate) fn yxml_element_next_sibling(&self) -> Option<Value> {
74
68
  self.0.borrow().next_sibling().map(|item| match item {
75
69
  Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
76
- Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
70
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text))),
77
71
  })
78
72
  }
79
- pub(crate) fn yxml_element_observe(
80
- &self,
81
- block: Proc
82
- ) -> Result<u32, Error> {
73
+ pub(crate) fn yxml_element_observe(&self, block: Proc) -> Result<u32, Error> {
83
74
  let change_added = Symbol::new("added").to_static();
84
75
  let change_retain = Symbol::new("retain").to_static();
85
76
  let change_removed = Symbol::new("removed").to_static();
86
77
 
87
- let subscription_id = self.0.borrow_mut().observe(
88
- move |transaction, xml_element_event| {
78
+ let subscription_id = self
79
+ .0
80
+ .borrow_mut()
81
+ .observe(move |transaction, xml_element_event| {
89
82
  let delta = xml_element_event.delta(transaction);
90
83
  let changes = RArray::with_capacity(delta.len());
91
84
 
@@ -103,9 +96,9 @@ impl YXmlElement {
103
96
  .aset(change_added, RArray::from_vec(values))
104
97
  .expect("cannot create change::added payload");
105
98
 
106
- changes.push(payload).expect(
107
- "cannot push payload to list of changes"
108
- );
99
+ changes
100
+ .push(payload)
101
+ .expect("cannot push payload to list of changes");
109
102
  }
110
103
  Change::Retain(position) => {
111
104
  let payload = RHash::new();
@@ -113,19 +106,19 @@ impl YXmlElement {
113
106
  .aset(change_retain, *position)
114
107
  .expect("cannot create change::retain payload");
115
108
 
116
- changes.push(payload).expect(
117
- "cannot push payload to list of changes"
118
- );
109
+ changes
110
+ .push(payload)
111
+ .expect("cannot push payload to list of changes");
119
112
  }
120
113
  Change::Removed(position) => {
121
114
  let payload = RHash::new();
122
- payload.aset(change_removed, *position).expect(
123
- "cannot create change::removed payload"
124
- );
115
+ payload
116
+ .aset(change_removed, *position)
117
+ .expect("cannot create change::removed payload");
125
118
 
126
- changes.push(payload).expect(
127
- "cannot push payload to list of changes"
128
- );
119
+ changes
120
+ .push(payload)
121
+ .expect("cannot push payload to list of changes");
129
122
  }
130
123
  }
131
124
  }
@@ -133,8 +126,7 @@ impl YXmlElement {
133
126
  block
134
127
  .call::<(RArray,), Value>((changes,))
135
128
  .expect("cannot call block");
136
- }
137
- );
129
+ });
138
130
 
139
131
  Ok(subscription_id.into())
140
132
  }
@@ -147,13 +139,13 @@ impl YXmlElement {
147
139
  pub(crate) fn yxml_element_prev_sibling(&self) -> Option<Value> {
148
140
  self.0.borrow().prev_sibling().map(|item| match item {
149
141
  Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
150
- Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
142
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text))),
151
143
  })
152
144
  }
153
145
  pub(crate) fn yxml_element_push_element_back(
154
146
  &self,
155
147
  transaction: &YTransaction,
156
- name: String
148
+ name: String,
157
149
  ) -> YXmlElement {
158
150
  let xml_element = self
159
151
  .0
@@ -165,7 +157,7 @@ impl YXmlElement {
165
157
  pub(crate) fn yxml_element_push_element_front(
166
158
  &self,
167
159
  transaction: &YTransaction,
168
- name: String
160
+ name: String,
169
161
  ) -> YXmlElement {
170
162
  let xml_element = self
171
163
  .0
@@ -174,10 +166,7 @@ impl YXmlElement {
174
166
 
175
167
  YXmlElement(RefCell::from(xml_element))
176
168
  }
177
- pub(crate) fn yxml_element_push_text_back(
178
- &self,
179
- transaction: &YTransaction
180
- ) -> YXmlText {
169
+ pub(crate) fn yxml_element_push_text_back(&self, transaction: &YTransaction) -> YXmlText {
181
170
  let xml_text = self
182
171
  .0
183
172
  .borrow_mut()
@@ -185,10 +174,7 @@ impl YXmlElement {
185
174
 
186
175
  YXmlText(RefCell::from(xml_text))
187
176
  }
188
- pub(crate) fn yxml_element_push_text_front(
189
- &self,
190
- transaction: &YTransaction
191
- ) -> YXmlText {
177
+ pub(crate) fn yxml_element_push_text_front(&self, transaction: &YTransaction) -> YXmlText {
192
178
  let xml_text = self
193
179
  .0
194
180
  .borrow_mut()
@@ -196,27 +182,20 @@ impl YXmlElement {
196
182
 
197
183
  YXmlText(RefCell::from(xml_text))
198
184
  }
199
- pub(crate) fn yxml_element_remove_attribute(
200
- &self,
201
- transaction: &YTransaction,
202
- name: String
203
- ) {
204
- self.0.borrow_mut().remove_attribute::<&str>(
205
- &mut *transaction.0.borrow_mut(),
206
- &name.as_str()
207
- );
185
+ pub(crate) fn yxml_element_remove_attribute(&self, transaction: &YTransaction, name: String) {
186
+ self.0
187
+ .borrow_mut()
188
+ .remove_attribute::<&str>(&mut *transaction.0.borrow_mut(), &name.as_str());
208
189
  }
209
190
  pub(crate) fn yxml_element_remove_range(
210
191
  &self,
211
192
  transaction: &YTransaction,
212
193
  index: u32,
213
- length: u32
194
+ length: u32,
214
195
  ) {
215
- self.0.borrow_mut().remove_range(
216
- &mut *transaction.0.borrow_mut(),
217
- index,
218
- length
219
- );
196
+ self.0
197
+ .borrow_mut()
198
+ .remove_range(&mut *transaction.0.borrow_mut(), index, length);
220
199
  }
221
200
  pub(crate) fn yxml_element_size(&self) -> u32 {
222
201
  self.0.borrow().len()
@@ -21,53 +21,38 @@ impl YXmlText {
21
21
  transaction: &YTransaction,
22
22
  index: u32,
23
23
  length: u32,
24
- attrs: RHash
24
+ attrs: RHash,
25
25
  ) -> Result<(), Error> {
26
26
  map_rhash_to_attrs(attrs).map(|a| {
27
- self.0.borrow_mut().format(
28
- &mut *transaction.0.borrow_mut(),
29
- index,
30
- length,
31
- a
32
- );
27
+ self.0
28
+ .borrow_mut()
29
+ .format(&mut *transaction.0.borrow_mut(), index, length, a);
33
30
  })
34
31
  }
35
- pub(crate) fn yxml_text_get_attribute(
36
- &self,
37
- name: String
38
- ) -> Option<String> {
32
+ pub(crate) fn yxml_text_get_attribute(&self, name: String) -> Option<String> {
39
33
  self.0.borrow().get_attribute(&*name)
40
34
  }
41
- pub(crate) fn yxml_text_insert(
42
- &self,
43
- transaction: &YTransaction,
44
- index: u32,
45
- content: String
46
- ) {
47
- self.0.borrow_mut().insert(
48
- &mut *transaction.0.borrow_mut(),
49
- index,
50
- &*content
51
- )
35
+ pub(crate) fn yxml_text_insert(&self, transaction: &YTransaction, index: u32, content: String) {
36
+ self.0
37
+ .borrow_mut()
38
+ .insert(&mut *transaction.0.borrow_mut(), index, &*content)
52
39
  }
53
40
  pub(crate) fn yxml_text_insert_attribute(
54
41
  &self,
55
42
  transaction: &YTransaction,
56
43
  name: String,
57
- value: String
44
+ value: String,
58
45
  ) {
59
- self.0.borrow_mut().insert_attribute(
60
- &mut *transaction.0.borrow_mut(),
61
- name,
62
- value
63
- )
46
+ self.0
47
+ .borrow_mut()
48
+ .insert_attribute(&mut *transaction.0.borrow_mut(), name, value)
64
49
  }
65
50
  pub(crate) fn yxml_text_insert_embed_with_attributes(
66
51
  &self,
67
52
  transaction: &YTransaction,
68
53
  index: u32,
69
54
  content: Value,
70
- attrs: RHash
55
+ attrs: RHash,
71
56
  ) -> Result<(), Error> {
72
57
  let yvalue = YValue::from(content);
73
58
  let avalue = Any::from(yvalue);
@@ -77,7 +62,7 @@ impl YXmlText {
77
62
  &mut *transaction.0.borrow_mut(),
78
63
  index,
79
64
  avalue,
80
- a
65
+ a,
81
66
  );
82
67
  })
83
68
  }
@@ -85,12 +70,12 @@ impl YXmlText {
85
70
  &self,
86
71
  transaction: &YTransaction,
87
72
  index: u32,
88
- embed: Value
73
+ embed: Value,
89
74
  ) {
90
75
  self.0.borrow_mut().insert_embed(
91
76
  &mut *transaction.0.borrow_mut(),
92
77
  index,
93
- Any::from(YValue::from(embed))
78
+ Any::from(YValue::from(embed)),
94
79
  )
95
80
  }
96
81
  pub(crate) fn yxml_text_insert_with_attributes(
@@ -98,14 +83,14 @@ impl YXmlText {
98
83
  transaction: &YTransaction,
99
84
  index: u32,
100
85
  content: String,
101
- attrs: RHash
86
+ attrs: RHash,
102
87
  ) -> Result<(), Error> {
103
88
  map_rhash_to_attrs(attrs).map(|a| {
104
89
  self.0.borrow_mut().insert_with_attributes(
105
90
  &mut *transaction.0.borrow_mut(),
106
91
  index,
107
92
  &*content,
108
- a
93
+ a,
109
94
  );
110
95
  })
111
96
  }
@@ -115,7 +100,7 @@ impl YXmlText {
115
100
  pub(crate) fn yxml_text_next_sibling(&self) -> Option<Value> {
116
101
  self.0.borrow().next_sibling().map(|item| match item {
117
102
  Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
118
- Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
103
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text))),
119
104
  })
120
105
  }
121
106
  pub(crate) fn yxml_text_parent(&self) -> Option<Value> {
@@ -127,14 +112,10 @@ impl YXmlText {
127
112
  pub(crate) fn yxml_text_prev_sibling(&self) -> Option<Value> {
128
113
  self.0.borrow().prev_sibling().map(|item| match item {
129
114
  Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
130
- Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
115
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text))),
131
116
  })
132
117
  }
133
- pub(crate) fn yxml_text_push(
134
- &self,
135
- transaction: &YTransaction,
136
- content: String
137
- ) {
118
+ pub(crate) fn yxml_text_push(&self, transaction: &YTransaction, content: String) {
138
119
  self.0
139
120
  .borrow_mut()
140
121
  .push(&mut *transaction.0.borrow_mut(), &*content)
@@ -143,13 +124,11 @@ impl YXmlText {
143
124
  &self,
144
125
  transaction: &YTransaction,
145
126
  index: u32,
146
- length: u32
127
+ length: u32,
147
128
  ) {
148
- self.0.borrow_mut().remove_range(
149
- &mut *transaction.0.borrow_mut(),
150
- index,
151
- length
152
- );
129
+ self.0
130
+ .borrow_mut()
131
+ .remove_range(&mut *transaction.0.borrow_mut(), index, length);
153
132
  }
154
133
  pub(crate) fn yxml_text_to_s(&self) -> String {
155
134
  self.0.borrow().to_string()
data/lib/y/array.rb CHANGED
@@ -20,6 +20,8 @@ module Y
20
20
  #
21
21
  # array.to_a == [1, 2, 3, 4, 5] # true
22
22
  class Array
23
+ include Enumerable
24
+
23
25
  # @!attribute [r] document
24
26
  #
25
27
  # @return [Y::Doc] The document this array belongs to
data/lib/y/awareness.rb CHANGED
@@ -1,53 +1,172 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Y
4
+ # The Awareness class implements a simple shared state protocol that can be
5
+ # used for non-persistent data like awareness information (cursor, username,
6
+ # status, ..). Each client can update its own local state and listen to state
7
+ # changes of remote clients.
8
+ #
9
+ # Each client is identified by a unique client id (something we borrow from
10
+ # doc.client_id). A client can override its own state by propagating a message
11
+ # with an increasing timestamp (clock). If such a message is received, it is
12
+ # applied if the known state of that client is older than the new state
13
+ # (`clock < new_clock`). If a client thinks that a remote client is offline,
14
+ # it may propagate a message with `{ clock, state: null, client }`. If such a
15
+ # message is received, and the known clock of that client equals the received
16
+ # clock, it will clean the state.
17
+ #
18
+ # Before a client disconnects, it should propagate a null state with an
19
+ # updated clock.
20
+ #
21
+ # Awareness is an integral part of collaborative applications, you can read
22
+ # more about the concept here: https://docs.yjs.dev/getting-started/adding-awareness
23
+ #
24
+ # @example Instantiate awareness instance and encode update for broadcast
25
+ # local_state = {
26
+ # editing: { field: "description", pos: 0 },
27
+ # name: "Hannes Moser"
28
+ # }.to_json
29
+ #
30
+ # awareness = Y::Awareness.new
31
+ # awareness.local_state = local_state
32
+ # awareness.diff # [1,227,245,175,195,11,1,65,123, …]
33
+ #
34
+ #
4
35
  class Awareness
5
- def apply_update(update)
6
- yawareness_apply_update(update)
36
+ # Applies an incoming update. This gets the local awareness instance in
37
+ # sync with changes from another client. i.e., updates the state of another
38
+ # user in the local awareness instance.
39
+ #
40
+ # @example Apply an incoming update
41
+ # update = [1,227,245,175,195,11,1,65,123, …]
42
+ #
43
+ # awareness = Y::Awareness.new
44
+ # awareness.sync(update)
45
+ #
46
+ # @param [Array<Integer>] diff A binary encoded update
47
+ # @return [void]
48
+ def sync(diff)
49
+ yawareness_apply_update(diff)
7
50
  end
8
51
 
52
+ # Clears out a state of a current client, effectively marking it as
53
+ # disconnected.
54
+ #
55
+ # @return [void]
9
56
  def clean_local_state
10
57
  yawareness_clean_local_state
11
58
  end
12
59
 
60
+ # Returns a globally unique client ID of an underlying Doc.
61
+ #
62
+ # @return [Integer] Returns the client_id of the local user
13
63
  def client_id
14
64
  yawareness_client_id
15
65
  end
16
66
 
67
+ # Returns a state map of all of the clients tracked by current Awareness
68
+ # instance. Those states are identified by their corresponding ClientIDs.
69
+ # The associated state is represented and replicated to other clients as a
70
+ # JSON string.
71
+ #
72
+ # @example Instantiate awareness instance and encode update for broadcast
73
+ # local_state = {
74
+ # editing: { field: "description", pos: 0 },
75
+ # name: "Hannes Moser"
76
+ # }.to_json
77
+ #
78
+ # awareness = Y::Awareness.new
79
+ # awareness.local_state = local_state
80
+ # awareness.clients # {312134501=>"{\"editing\":{\"field\":\"descriptio …
81
+ #
82
+ # @return [Hash] All clients and their current state
17
83
  def clients
18
84
  yawareness_clients
19
85
  end
20
86
 
87
+ # Returns a JSON string state representation of a current Awareness
88
+ # instance.
89
+ #
90
+ # @example Create local state and inspect it
91
+ # local_state = {
92
+ # editing: { field: "description", pos: 0 },
93
+ # name: "Hannes Moser"
94
+ # }.to_json
95
+ #
96
+ # awareness = Y::Awareness.new
97
+ # awareness.local_state = local_state
98
+ # local_state # "{\"editing\":{\"field\":\"description\",\"pos\":0}, …
99
+ #
100
+ # @return [String] The current state of the local client
21
101
  def local_state
22
102
  yawareness_local_state
23
103
  end
24
104
 
105
+ # Sets a current Awareness instance state to a corresponding JSON string.
106
+ # This state will be replicated to other clients as part of the
107
+ # AwarenessUpdate.
108
+ #
109
+ # @example Set local state
110
+ # local_state = {
111
+ # editing: { field: "description", pos: 0 },
112
+ # name: "Hannes Moser"
113
+ # }.to_json
114
+ #
115
+ # awareness = Y::Awareness.new
116
+ # awareness.local_state = local_state
117
+ #
118
+ # @return [void]
25
119
  def local_state=(json)
26
120
  yawareness_set_local_state(json)
27
121
  end
28
122
 
123
+ # Subscribes to changes
124
+ #
125
+ # @return [Integer] The subscription ID
29
126
  def attach(callback, &block)
30
127
  return yawareness_on_update(callback) unless callback.nil?
31
128
 
32
129
  yawareness_on_update(block.to_proc) unless block.nil?
33
130
  end
34
131
 
132
+ # Unsubscribe from changes
133
+ #
134
+ # @param [Integer] subscription_id
135
+ # @return [void]
35
136
  def detach(subscription_id)
36
137
  yawareness_remove_on_update(subscription_id)
37
138
  end
38
139
 
140
+ # Clears out a state of a given client, effectively marking it as
141
+ # disconnected.
142
+ #
143
+ # @param [Integer] client_id Clears the state for given client_id
144
+ # @return [void]
39
145
  def remove_state(client_id)
40
146
  yawareness_remove_state(client_id)
41
147
  end
42
148
 
43
- def update
149
+ # Returns a serializable update object which is representation of a current
150
+ # Awareness state.
151
+ #
152
+ # @return [::Array<Integer>] Binary encoded update of the local instance
153
+ def diff
44
154
  yawareness_update
45
155
  end
46
156
 
47
- def update_with_clients(clients)
157
+ # Returns a serializable update object which is representation of a current
158
+ # Awareness state. Unlike Awareness::update, this method variant allows to
159
+ # prepare update only for a subset of known clients. These clients must all
160
+ # be known to a current Awareness instance, otherwise a
161
+ # Error::ClientNotFound error will be returned.
162
+ #
163
+ # @param [::Array<Integer>] clients A list of client IDs
164
+ # @return [String] Binary encoded update including all given client IDs
165
+ def diff_with_clients(*clients)
48
166
  yawareness_update_with_clients(clients)
49
167
  end
50
168
 
169
+ # rubocop:disable Lint/UselessAccessModifier
51
170
  private
52
171
 
53
172
  # @!method yawareness_apply_update(update)
@@ -56,6 +175,12 @@ module Y
56
175
  # @param [Y::AwarenessUpdate] A structure that represents an encodable state
57
176
  # of an Awareness struct.
58
177
 
178
+ # @!method yawareness_apply_update(update)
179
+ # Applies an update
180
+ #
181
+ # @param [Y::AwarenessUpdate] A structure that represents an encodable state
182
+ # of an Awareness struct.
183
+
59
184
  # @!method yawareness_clean_local_state
60
185
  # Clears out a state of a current client , effectively marking it as
61
186
  # disconnected.
@@ -90,7 +215,7 @@ module Y
90
215
  # Clears out a state of a given client, effectively marking it as
91
216
  # disconnected.
92
217
  #
93
- # @param [Integer] A Client ID
218
+ # @param [Integer] client_id A Client ID
94
219
  # @return [String|nil] Returns a JSON string state representation of a
95
220
  # current Awareness instance.
96
221
 
@@ -118,35 +243,24 @@ module Y
118
243
  # These clients must all be known to a current Awareness instance,
119
244
  # otherwise an error will be returned.
120
245
  #
121
- # @param [Array<Integer>]
122
- # @return [Y::AwarenessUpdate] The update object
246
+ # @param [::Array<Integer>] clients
247
+ # @return [::Array<Integer>] A serialized (binary encoded) update object
248
+
249
+ # rubocop:enable Lint/UselessAccessModifier
123
250
  end
124
251
 
125
- # rubocop:disable Lint/EmptyClass
252
+ # rubocop:disable Lint/UselessAccessModifier
126
253
  class AwarenessEvent
127
254
  private
128
255
 
129
256
  # @!method added
130
- # @return [Array<Integer>] Added clients
257
+ # @return [::Array<Integer>] Added clients
131
258
 
132
259
  # @!method updated
133
- # @return [Array<Integer>] Updated clients
260
+ # @return [::Array<Integer>] Updated clients
134
261
 
135
262
  # @!method removed
136
- # @return [Array<Integer>] Removed clients
137
- end
138
- # rubocop:enable Lint/EmptyClass
139
-
140
- class AwarenessUpdate
141
- def encode
142
- yawareness_update_encode
143
- end
144
-
145
- private
146
-
147
- # @!method yawareness_update_encode
148
- # Encode the awareness state for simple transport
149
- #
150
- # @return [Array<Integer>] Encoded update
263
+ # @return [::Array<Integer>] Removed clients
151
264
  end
265
+ # rubocop:enable Lint/UselessAccessModifier
152
266
  end
data/lib/y/doc.rb CHANGED
@@ -113,7 +113,7 @@ module Y
113
113
  # @return [Y::XMLElement]
114
114
  def get_xml_element(name)
115
115
  xml_element = current_transaction.get_xml_element(name)
116
- xml_element.document = self
116
+ xml_element&.document = self
117
117
  xml_element
118
118
  end
119
119
 
data/lib/y/map.rb CHANGED
@@ -18,6 +18,8 @@ module Y
18
18
  # map[:hello] = "world"
19
19
  # puts map[:hello]
20
20
  class Map
21
+ include Enumerable
22
+
21
23
  # @!attribute [r] document
22
24
  #
23
25
  # @return [Y::Doc] The document this map belongs to
data/lib/y/text.rb CHANGED
@@ -115,7 +115,7 @@ module Y
115
115
  # - Hash (where the the types of key and values must be supported)
116
116
  #
117
117
  # @param [Integer] index
118
- # @param [String, Float, Array, Hash] value
118
+ # @param [String, Numeric, Array, Hash] value
119
119
  # @param [Hash|nil] attrs
120
120
  # @return [void]
121
121
  def insert(index, value, attrs = nil)
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.2.0"
4
+ VERSION = "0.3.1"
5
5
  end