jini 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b65fc1371e128668267e06dd8d9741024328aae50174a89ec4d1657030e07b3
4
- data.tar.gz: efecbc79fb6b7ec16184e4b4874cd997deddaeab5b2558b877841804d55897f7
3
+ metadata.gz: 5379b78c4435098f9165b6783ec4ed91b4d4816d06d29a0d1d703c72060129a5
4
+ data.tar.gz: 5b4bf01914e5e2eb91bacb4c17b4ed8ba18205ad2e6bb23f01266ed1d18da5ca
5
5
  SHA512:
6
- metadata.gz: af1483215d88f366e8c270a723db876e2c6ea3c6b3110456e19eacc58ba8fdb7ad59d43c6f555b94960370275ca7c6ad6d20e49e8ae18ec965d8ea6d809ea0af
7
- data.tar.gz: f191f77268b0c4e5c0cf4f44a0677f047f64abac96285a52ab0839cb7c3cb3119f05560195885c509e67d5cdcff37442fa1b8bf35b04fa9b58eac7a2947fa67b
6
+ metadata.gz: 8b1de26cf0a4638dd06956b200424232522d59bfc8ff1e370e8f345866a3bbb5adc506f51e85ef1e38efd84c45e1531e965a6b3205b26c2b0e3959dc13a54c8f
7
+ data.tar.gz: 05e135843c3dc17440b7a0c4bdafd7b115329bb8be8711c857c79b8925782b253d996e923aa58a0504efcc563d08a3e219e5db8c4ba45ed1c94a58b6d79186e2
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  rdoc/
6
6
  .idea/
7
7
  coverage/
8
+ test/
data/.yardoc/checksums CHANGED
@@ -1 +1 @@
1
- lib/jini.rb cc676e38b9ad1128e71f799c39f219bd38a7f804
1
+ lib/jini.rb 153b27246e75d25eea4308526dc0af51c4206b9d
Binary file
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Thu Sep 15 17:05:16 2022 by
128
+ Generated on Thu Sep 15 17:17:05 2022 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.27 (ruby-3.0.0).
131
131
  </div>
data/doc/Jini.html CHANGED
@@ -328,7 +328,7 @@
328
328
 
329
329
 
330
330
  <span class="summary_desc"><div class='inline'>
331
- <p>Removes attr by name before: /<a href="@k="v"">parent/child</a> .remove_attr(k’) after: /parent/child.</p>
331
+ <p>Removes attr by name before: ‘/<a href="@k="v"">parent/child</a>` .remove_attr(k’) after: ‘/parent/child`.</p>
332
332
  </div></span>
333
333
 
334
334
  </li>
@@ -981,7 +981,7 @@
981
981
  </h3><div class="docstring">
982
982
  <div class="discussion">
983
983
 
984
- <p>Removes attr by name before: /<a href="@k="v"">parent/child</a> .remove_attr(k’) after: /parent/child</p>
984
+ <p>Removes attr by name before: ‘/<a href="@k="v"">parent/child</a>` .remove_attr(k’) after: ‘/parent/child`</p>
985
985
 
986
986
 
987
987
  </div>
@@ -1270,7 +1270,7 @@
1270
1270
  </div>
1271
1271
 
1272
1272
  <div id="footer">
1273
- Generated on Thu Sep 15 17:05:16 2022 by
1273
+ Generated on Thu Sep 15 17:17:05 2022 by
1274
1274
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1275
1275
  0.9.27 (ruby-3.0.0).
1276
1276
  </div>
data/doc/_index.html CHANGED
@@ -112,7 +112,7 @@
112
112
  </div>
113
113
 
114
114
  <div id="footer">
115
- Generated on Thu Sep 15 17:05:16 2022 by
115
+ Generated on Thu Sep 15 17:17:05 2022 by
116
116
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
117
117
  0.9.27 (ruby-3.0.0).
118
118
  </div>
data/doc/file.README.html CHANGED
@@ -89,7 +89,7 @@ is <em>building</em> XPATHs.</p>
89
89
  </div></div>
90
90
 
91
91
  <div id="footer">
92
- Generated on Thu Sep 15 17:05:16 2022 by
92
+ Generated on Thu Sep 15 17:17:05 2022 by
93
93
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
94
94
  0.9.27 (ruby-3.0.0).
95
95
  </div>
data/doc/index.html CHANGED
@@ -89,7 +89,7 @@ is <em>building</em> XPATHs.</p>
89
89
  </div></div>
90
90
 
91
91
  <div id="footer">
92
- Generated on Thu Sep 15 17:05:16 2022 by
92
+ Generated on Thu Sep 15 17:17:05 2022 by
93
93
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
94
94
  0.9.27 (ruby-3.0.0).
95
95
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Thu Sep 15 17:05:16 2022 by
103
+ Generated on Thu Sep 15 17:17:05 2022 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.27 (ruby-3.0.0).
106
106
  </div>
data/jini.gemspec CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
5
5
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
6
6
  s.required_ruby_version = '>=3.0.0'
7
7
  s.name = 'jini'
8
- s.version = '0.0.2'
8
+ s.version = '0.0.3'
9
9
  s.license = 'MIT'
10
10
  s.summary = 'Simple Immutable Ruby XPATH Builder'
11
11
  s.description = 'Class Jini helps you build a XPATH and then modify its \
data/jini.iml CHANGED
@@ -4,6 +4,7 @@
4
4
  <exclude-output />
5
5
  <content url="file://$MODULE_DIR$">
6
6
  <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
7
+ <excludeFolder url="file://$MODULE_DIR$/coverage" />
7
8
  </content>
8
9
  <orderEntry type="inheritedJdk" />
9
10
  <orderEntry type="sourceFolder" forTests="false" />
data/lib/jini.rb CHANGED
@@ -104,23 +104,22 @@ class Jini
104
104
  # @param node [String] name of node for removal
105
105
  # @return [Jini] without a node
106
106
  def remove_path(node)
107
- copy = @head
108
- Jini.new(copy.gsub("/#{node}", ''))
107
+ Jini.new(@head.gsub("/#{node}", ''))
109
108
  end
110
109
 
111
110
  # Removes attr by name
112
111
  # before:
113
- # /parent/child[@k="v"]
112
+ # `/parent/child[@k="v"]`
114
113
  # .remove_attr('k')
115
114
  # after:
116
- # /parent/child
115
+ # `/parent/child`
117
116
  # @param [String] name of attr
118
117
  # @return [Jini] without an attr
119
118
  def remove_attr(name)
120
119
  Jini.new(
121
120
  @head
122
121
  .gsub(
123
- /(\[@|#{name}="[^"]+"|[]+|])/,
122
+ /(\[@?#{name}="[^"]+"(\[\]+|\]))/,
124
123
  ''
125
124
  )
126
125
  )
data/test/jini_test.rb CHANGED
@@ -83,4 +83,19 @@ class JiniTest < Minitest::Test
83
83
  .to_s
84
84
  )
85
85
  end
86
+
87
+ def test_remove_attr_many
88
+ assert_equal(
89
+ '/parent/child/toy',
90
+ Jini
91
+ .new
92
+ .add_path('parent')
93
+ .add_path('child')
94
+ .add_attr('age', 'teen')
95
+ .add_path('toy')
96
+ .add_attr('age', 'old')
97
+ .remove_attr('age')
98
+ .to_s
99
+ )
100
+ end
86
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jini
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Ivanchuck