class Binford::RubyToolbox

Attributes

gem[R]

Public Class Methods

new(gem) click to toggle source
Calls superclass method
# File lib/binford/ruby_toolbox.rb, line 7
def initialize(gem)
  super("https://www.ruby-toolbox.com/", serializer: Serializers::HTML.new)
  @gem = gem
end

Public Instance Methods

data() click to toggle source
# File lib/binford/ruby_toolbox.rb, line 12
def data
  {
    name: gem,
    score: score,
    description: description
  }
end
description() click to toggle source
# File lib/binford/ruby_toolbox.rb, line 24
def description
  @description ||= document&.xpath("/html/body/section/div/section/div/div[4]/div")&.text
end
document() click to toggle source
# File lib/binford/ruby_toolbox.rb, line 28
def document
  @document ||= get("/projects/#{gem}")
end
score() click to toggle source
# File lib/binford/ruby_toolbox.rb, line 20
def score
  @score ||= document&.xpath("/html/body/section/div/section/div/div[1]/div[2]/div[1]/span[2]")&.text&.to_f
end