class AggregatedVelocitator
Attributes
aggregated_versions[R]
TODO can probably get rid of this
version[R]
the one with the wildcard
versions[R]
all of the ones matched, aggregated_versions
Public Class Methods
new(gem_name, top_level_ver)
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 12 def initialize(gem_name, top_level_ver) @gem_name = gem_name @version = top_level_ver #with a wildcard/x @versions = @aggregated_versions = gem_data.versions.select{|v| v.match(/^#{Regexp.escape(remove_trailing_x(top_level_ver))}/) } raise NoSuchVersion, "no versions found for #{@version}!" if @aggregated_versions.empty? after_init end
Public Instance Methods
default_max_value()
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 25 def default_max_value base_max_for(@aggregated_versions) * @aggregated_versions.size end
default_start()
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 20 def default_start smallest_version = @aggregated_versions.map{|v| ComparableVersion.new(v)}.sort.first.str built_at(smallest_version) end
hide_legend?()
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 50 def hide_legend? true end
line_data(start_t = nil, end_t = nil)
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 29 def line_data(start_t = nil, end_t = nil) range = nil if start_t && end_t range = compute_day_range_from_start_end(start_t,end_t) else range = effective_days_in_range end ret = Hash.new(0) @aggregated_versions.each do |v| range.each do |d| ret[d] += downloads_per_day(v)[d] || 0 end end range.map{|d| ret[d] } end
title()
click to toggle source
# File lib/gem_velocity/velocitators/aggregated_velocitator.rb, line 46 def title "#{@gem_name}: #{@version}\n(downloads: #{num_downloads})" end