ryoba 1.1.0 → 2.0.0

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: 16fd5950cac40b739a0578ed3af49099f4dc4866ea1e52b1e11b2120b4901320
4
- data.tar.gz: 4899e26d14262f21ce419615ac1a574f9a6355fd24c7bf42c6b96044000a701b
3
+ metadata.gz: dbea6a62f02bcec9504fb66b9f43619103cf4a90010e7bc56b66e650d2737e04
4
+ data.tar.gz: fd92a7df7d967d79ae34f527d5f0c025d1e06b53592f86f4264539a44339bf52
5
5
  SHA512:
6
- metadata.gz: ae9ff3dca31fad1510852a3af7270bab7641957f7a6b0f0fd54a2eafda9ecd062ca16fe3974eb791e4ef10cf74f162e81b4abc6d20a87637ca796d15ddf67b1f
7
- data.tar.gz: 56298bda462fe9c8fe5bd6f4066bf7d83c89d9a806c2732e06915ff98d26a40743fa6528f39c5ed4a918dfe2674a2eb185b00e0378d49d644c54bcabea7f2140
6
+ metadata.gz: 02d81589dd867ed1555ebb82123ff8cf132b571d3da5893517af6d4e7b7ccc99c54a704a271263fa0592064754329bf7d8e8692e18c9d436a5c95000d7e6d9ef
7
+ data.tar.gz: c0eede04b599c9d96f2f7294a778b0bc2ea53c13f17e2daeb8606e0b972e7b3776d3b94c2f6dd3c7aa33a7a94189d72b26509e20fc6fbd17d723bc7600ef4087
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.0.0
2
+
3
+ * [BREAKING] Drop support for Ruby < 3.4
4
+
5
+
1
6
  ## 1.1.0
2
7
 
3
8
  * Rename `Nokogiri::XML::Node#text!` to `#content!`, and alias as
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
3
  # Specify your gem's dependencies in ryoba.gemspec
6
4
  gemspec
5
+
6
+ gem "rake", "~> 13.0"
7
+ gem "minitest", "~> 6.0"
data/README.md CHANGED
@@ -5,45 +5,34 @@
5
5
 
6
6
  ## API
7
7
 
8
- - [Nokogiri::XML::Document](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Document)
9
- - [#uri](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Document:uri)
10
- - [Nokogiri::XML::Node](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node)
11
- - [#content!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:content%21)
12
- - aliased as [#inner_text!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:inner_text%21)
13
- - aliased as [#text!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:text%21)
14
- - [#content?](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:content%3F)
15
- - aliased as [#inner_text?](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:inner_text%3F)
16
- - [#matches!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:matches%21)
17
- - [#uri](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:uri)
18
- - [Nokogiri::XML::Searchable](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable)
19
- - [#ancestor](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestor)
20
- - [#ancestor!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestor%21)
21
- - [#ancestors!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestors%21)
22
- - [#at!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:at%21)
23
- - [#search!](http://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:search%21)
8
+ - [`Nokogiri::XML::Document`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Document)
9
+ - [`#uri`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Document:uri)
10
+ - [`Nokogiri::XML::Node`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node)
11
+ - [`#content!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:content%21)
12
+ - aliased as [`#inner_text!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:inner_text%21)
13
+ - aliased as [`#text!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:text%21)
14
+ - [`#content?`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:content%3F)
15
+ - aliased as [`#inner_text?`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:inner_text%3F)
16
+ - [`#matches!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:matches%21)
17
+ - [`#uri`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Node:uri)
18
+ - [`Nokogiri::XML::Searchable`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable)
19
+ - [`#ancestor`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestor)
20
+ - [`#ancestor!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestor%21)
21
+ - [`#ancestors!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:ancestors%21)
22
+ - [`#at!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:at%21)
23
+ - [`#search!`](https://www.rubydoc.info/gems/ryoba/Nokogiri/XML/Searchable:search%21)
24
24
 
25
25
 
26
26
  ## Installation
27
27
 
28
- Install from [Ruby Gems](https://rubygems.org/gems/ryoba):
29
-
30
- ```bash
31
- $ gem install ryoba
32
- ```
33
-
34
- Then require in your Ruby script:
35
-
36
- ```ruby
37
- require "ryoba"
38
- ```
28
+ Install the [`ryoba` gem](https://rubygems.org/gems/ryoba).
39
29
 
40
30
 
41
31
  ## Contributing
42
32
 
43
- Run `rake test` to run the tests. You can also run `rake irb` for an
44
- interactive prompt that pre-loads the project code.
33
+ Run `rake test` to run the tests.
45
34
 
46
35
 
47
36
  ## License
48
37
 
49
- [MIT License](https://opensource.org/licenses/MIT)
38
+ [MIT License](LICENSE.txt)
data/Rakefile CHANGED
@@ -1,18 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
- require "yard"
4
-
5
-
6
- YARD::Rake::YardocTask.new(:doc) do |t|
7
- end
8
-
9
- desc "Launch IRB with this gem pre-loaded"
10
- task :irb do
11
- require "ryoba"
12
- require "irb"
13
- ARGV.clear
14
- IRB.start
15
- end
16
3
 
17
4
  Rake::TestTask.new(:test) do |t|
18
5
  t.libs << "test"
@@ -2,7 +2,7 @@ require "uri"
2
2
 
3
3
  class Nokogiri::XML::Document
4
4
 
5
- # Constructs a URI from the document's +url+ if +url+ is not nil.
5
+ # Constructs a URI from the Document's +url+, unless +url+ is nil.
6
6
  #
7
7
  # @example
8
8
  # xml = Nokogiri::XML(<<-XML, "https://www.example.com/foo")
@@ -2,7 +2,7 @@ require "uri"
2
2
 
3
3
  class Nokogiri::XML::Node
4
4
 
5
- # Equivalent to +.content.strip+, but returns nil if the result is an
5
+ # Equivalent to +content.strip+, but returns nil if the result is an
6
6
  # empty string.
7
7
  #
8
8
  # @example
@@ -28,8 +28,8 @@ class Nokogiri::XML::Node
28
28
 
29
29
  alias_method :inner_text?, :content?
30
30
 
31
- # Equivalent to +.content.strip+, but raises an error if the result is
32
- # an empty string.
31
+ # Equivalent to +content.strip+, but raises an exception if the result
32
+ # is an empty string.
33
33
  #
34
34
  # @example
35
35
  # xml = Nokogiri::XML(<<-XML)
@@ -44,11 +44,11 @@ class Nokogiri::XML::Node
44
44
  #
45
45
  # xml.at("h1").content! # == "Headline 1"
46
46
  # xml.at("h2").content! # == "Headline 2"
47
- # xml.at("h3").content! # raise error
47
+ # xml.at("h3").content! # raises exception
48
48
  #
49
49
  # @return [String]
50
50
  # @raise [Ryoba::Error]
51
- # if result is an empty string
51
+ # if +content.strip+ returns an empty string
52
52
  def content!
53
53
  result = self.content.strip
54
54
  if result.empty?
@@ -61,7 +61,7 @@ class Nokogiri::XML::Node
61
61
  alias_method :text!, :content!
62
62
 
63
63
  # Like +Node#matches?+, but returns the Node if +selector+ matches,
64
- # and raises an error otherwise.
64
+ # and raises an exception otherwise.
65
65
  #
66
66
  # @example
67
67
  # xml = Nokogiri::XML(<<-XML)
@@ -71,8 +71,8 @@ class Nokogiri::XML::Node
71
71
  # </body>
72
72
  # XML
73
73
  #
74
- # xml.at("#a").matches(".c")! # == Node div#a.c
75
- # xml.at("#b").matches(".c")! # raise error
74
+ # xml.at("#a").matches!(".c") # == Node div#a.c
75
+ # xml.at("#b").matches!(".c") # raises exception
76
76
  #
77
77
  # @param selector [String]
78
78
  # @return [self]
@@ -93,9 +93,9 @@ class Nokogiri::XML::Node
93
93
  }
94
94
 
95
95
  # Builds a URI from a specified attribute. If no attribute is
96
- # specified, an element-appropriate attribute will be chosen from
97
- # {HTML_ELEMENT_URI_ATTRIBUTES}, if possible. Relative URIs will be
98
- # converted to absolute URIs using the Node document's +url+, if
96
+ # specified, an element-appropriate attribute is chosen from
97
+ # {HTML_ELEMENT_URI_ATTRIBUTES}, if possible. Relative URIs are
98
+ # converted to absolute URIs using the Node's +document.url+, if
99
99
  # possible.
100
100
  #
101
101
  # @example
@@ -1,7 +1,6 @@
1
1
  module Nokogiri::XML::Searchable
2
2
 
3
- # Like +Searchable#search+, but raises an error if there are no
4
- # results.
3
+ # Like +#search+, but raises an exception if there are no results.
5
4
  #
6
5
  # @example
7
6
  # xml = Nokogiri::XML(<<-XML)
@@ -12,7 +11,7 @@ module Nokogiri::XML::Searchable
12
11
  # XML
13
12
  #
14
13
  # xml.search!("div") # == NodeSet [div#a, div#b]
15
- # xml.search!("img") # raise error
14
+ # xml.search!("img") # raises exception
16
15
  #
17
16
  # @param queries [Array<String>]
18
17
  # @return [Nokogiri::XML::NodeSet]
@@ -26,7 +25,7 @@ module Nokogiri::XML::Searchable
26
25
  results
27
26
  end
28
27
 
29
- # Like +Searchable#at+, but raises an error if there are no results.
28
+ # Like +#at+, but raises an exception if there are no results.
30
29
  #
31
30
  # @example
32
31
  # xml = Nokogiri::XML(<<-XML)
@@ -37,7 +36,7 @@ module Nokogiri::XML::Searchable
37
36
  # XML
38
37
  #
39
38
  # xml.at!("div") # == Node div#a
40
- # xml.at!("img") # raise error
39
+ # xml.at!("img") # raises exception
41
40
  #
42
41
  # @param queries [Array<String>]
43
42
  # @return [Nokogiri::XML::Element]
@@ -51,8 +50,8 @@ module Nokogiri::XML::Searchable
51
50
  result
52
51
  end
53
52
 
54
- # Like +Searchable#ancestors+, but raises an error if there are no
55
- # matching ancestors.
53
+ # Like +#ancestors+, but raises an exception if there are no matching
54
+ # ancestors.
56
55
  #
57
56
  # @example
58
57
  # xml = Nokogiri::XML(<<-XML)
@@ -65,9 +64,10 @@ module Nokogiri::XML::Searchable
65
64
  # </body>
66
65
  # XML
67
66
  #
67
+ # xml.at("img").ancestors! # == NodeSet [div#b, div#a, body]
68
68
  # xml.at("img").ancestors!("div") # == NodeSet [div#b, div#a]
69
69
  # xml.at("img").ancestors!("#a") # == NodeSet [div#a]
70
- # xml.at("img").ancestors!("#z") # raise error
70
+ # xml.at("img").ancestors!("#z") # raises exception
71
71
  #
72
72
  # @param selector [String]
73
73
  # @return [Nokogiri::XML::NodeSet]
@@ -81,8 +81,7 @@ module Nokogiri::XML::Searchable
81
81
  results
82
82
  end
83
83
 
84
- # Like +Searchable#ancestors+, but returns only the first matching
85
- # ancestor.
84
+ # Like +#ancestors+, but returns only the first matching ancestor.
86
85
  #
87
86
  # @example
88
87
  # xml = Nokogiri::XML(<<-XML)
@@ -95,9 +94,9 @@ module Nokogiri::XML::Searchable
95
94
  # </body>
96
95
  # XML
97
96
  #
98
- # xml.at("img").ancestor("div") # == Node div#b
99
- # xml.at("img").ancestor("#a") # == Node div#a
100
- # xml.at("img").ancestor("#z") # == nil
97
+ # xml.at("img").ancestor # == Node div#b
98
+ # xml.at("img").ancestor("#a") # == Node div#a
99
+ # xml.at("img").ancestor("#z") # == nil
101
100
  #
102
101
  # @param selector [String]
103
102
  # @return [Nokogiri::XML::Element, nil]
@@ -105,8 +104,7 @@ module Nokogiri::XML::Searchable
105
104
  self.ancestors(selector).first
106
105
  end
107
106
 
108
- # Like +Searchable#ancestors!+, but returns only the first matching
109
- # ancestor.
107
+ # Like {ancestors!}, but returns only the first matching ancestor.
110
108
  #
111
109
  # @example
112
110
  # xml = Nokogiri::XML(<<-XML)
@@ -119,9 +117,9 @@ module Nokogiri::XML::Searchable
119
117
  # </body>
120
118
  # XML
121
119
  #
122
- # xml.at("img").ancestor!("div") # == Node div#b
123
- # xml.at("img").ancestor!("#a") # == Node div#a
124
- # xml.at("img").ancestor!("#z") # raise error
120
+ # xml.at("img").ancestor! # == Node div#b
121
+ # xml.at("img").ancestor!("#a") # == Node div#a
122
+ # xml.at("img").ancestor!("#z") # raises exception
125
123
  #
126
124
  # @param selector [String]
127
125
  # @return [Nokogiri::XML::Element]
data/lib/ryoba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ryoba
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/ryoba.gemspec CHANGED
@@ -1,29 +1,27 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "ryoba/version"
1
+ require_relative "lib/ryoba/version"
5
2
 
6
3
  Gem::Specification.new do |spec|
7
4
  spec.name = "ryoba"
8
5
  spec.version = Ryoba::VERSION
9
6
  spec.authors = ["Jonathan Hefner"]
10
- spec.email = ["jonathan.hefner@gmail.com"]
7
+ spec.email = ["jonathan@hefner.pro"]
11
8
 
12
9
  spec.summary = %q{Nokogiri utility methods}
13
10
  spec.homepage = "https://github.com/jonathanhefner/ryoba"
14
11
  spec.license = "MIT"
12
+ spec.required_ruby_version = ">= 3.4"
13
+
14
+ spec.metadata["source_code_uri"] = spec.homepage
15
+ spec.metadata["changelog_uri"] = spec.metadata["source_code_uri"] + "/blob/master/CHANGELOG.md"
15
16
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.start_with?("test/", ".git") }
18
21
  end
19
22
  spec.bindir = "exe"
20
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
24
  spec.require_paths = ["lib"]
22
25
 
23
- spec.add_runtime_dependency "nokogiri", ">= 1.6.6", "< 2.0"
24
-
25
- spec.add_development_dependency "bundler", "~> 1.16"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "minitest", "~> 5.0"
28
- spec.add_development_dependency "yard", "~> 0.9"
26
+ spec.add_dependency "nokogiri", ">= 1.6.6", "< 2.0"
29
27
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ryoba
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hefner
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2019-07-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -30,71 +29,12 @@ dependencies:
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: '2.0'
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.16'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.16'
47
- - !ruby/object:Gem::Dependency
48
- name: rake
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '10.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '10.0'
61
- - !ruby/object:Gem::Dependency
62
- name: minitest
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '5.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '5.0'
75
- - !ruby/object:Gem::Dependency
76
- name: yard
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '0.9'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '0.9'
89
- description:
90
32
  email:
91
- - jonathan.hefner@gmail.com
33
+ - jonathan@hefner.pro
92
34
  executables: []
93
35
  extensions: []
94
36
  extra_rdoc_files: []
95
37
  files:
96
- - ".gitignore"
97
- - ".travis.yml"
98
38
  - CHANGELOG.md
99
39
  - Gemfile
100
40
  - LICENSE.txt
@@ -110,8 +50,9 @@ files:
110
50
  homepage: https://github.com/jonathanhefner/ryoba
111
51
  licenses:
112
52
  - MIT
113
- metadata: {}
114
- post_install_message:
53
+ metadata:
54
+ source_code_uri: https://github.com/jonathanhefner/ryoba
55
+ changelog_uri: https://github.com/jonathanhefner/ryoba/blob/master/CHANGELOG.md
115
56
  rdoc_options: []
116
57
  require_paths:
117
58
  - lib
@@ -119,15 +60,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
60
  requirements:
120
61
  - - ">="
121
62
  - !ruby/object:Gem::Version
122
- version: '0'
63
+ version: '3.4'
123
64
  required_rubygems_version: !ruby/object:Gem::Requirement
124
65
  requirements:
125
66
  - - ">="
126
67
  - !ruby/object:Gem::Version
127
68
  version: '0'
128
69
  requirements: []
129
- rubygems_version: 3.0.1
130
- signing_key:
70
+ rubygems_version: 4.0.10
131
71
  specification_version: 4
132
72
  summary: Nokogiri utility methods
133
73
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.5
5
- before_install: gem install bundler -v 1.16.1