module RubotySonar
Constants
- RUBOTY_SEARCH_CONDITION
- VERSION
Public Class Methods
info(gem_name)
click to toggle source
# File lib/ruboty-sonar.rb, line 36 def self.info(gem_name) gem_info = Gems.info(gem_name) { name: gem_info['name'], desc: gem_info['info'], downloads: gem_info['downloads'], rubygems_uri: gem_info['project_uri'], homepage_uri: gem_info['homepage_uri'] } end
random()
click to toggle source
# File lib/ruboty-sonar.rb, line 47 def self.random gem_info = search(RUBOTY_SEARCH_CONDITION).sample { name: gem_info['name'], desc: gem_info['info'], downloads: gem_info['downloads'], rubygems_uri: gem_info['project_uri'], homepage_uri: gem_info['homepage_uri'] } end
ranking(limit = 5)
click to toggle source
# File lib/ruboty-sonar.rb, line 58 def self.ranking(limit = 5) search(RUBOTY_SEARCH_CONDITION) .map do |e| { name: e['name'], downloads: e['downloads'].to_i, authors: e['authors'] } end.sort_by { |e|-e[:downloads] } .take(limit) end
search(query)
click to toggle source
# File lib/ruboty-sonar.rb, line 24 def self.search(query) results = [] page = 1 loop do ret = Gems.search_with_page(query, page) break if ret.empty? results += ret page += 1 end results end