Class: GemChanges::Gem
- Inherits:
-
Struct
- Object
- Struct
- GemChanges::Gem
- Defined in:
- lib/gem_changes/gem.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/gem_changes/gem.rb', line 6 def name @name end |
Instance Method Details
#changelog_uri ⇒ Object
11 12 13 14 15 |
# File 'lib/gem_changes/gem.rb', line 11 def changelog_uri rubygems_document.css("a#changelog").first["href"] rescue StandardError nil end |
#rubygems_uri ⇒ Object
7 8 9 |
# File 'lib/gem_changes/gem.rb', line 7 def rubygems_uri URI.parse("https://rubygems.org/gems/#{name}") end |
#source_code_uri ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gem_changes/gem.rb', line 17 def source_code_uri github_span = rubygems_document.at_css("span.github-btn") if github_span user = github_span.attr("data-user") repo = github_span.attr("data-repo") return "https://github.com/#{user}/#{repo}" end code = rubygems_document.at_css("a#code")&.attr("href") home = rubygems_document.at_css("a#home")&.attr("href") [code, home].compact.first rescue StandardError nil end |