Class: BaseVelocitator

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/gem_velocity/velocitators/base_velocitator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#time_format_str, #time_format_str_small

Instance Attribute Details

#date_rangeObject

modifiers on the end result image being rendered. Essentially these are the boundries of the graph



20
21
22
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 20

def date_range
  @date_range
end

#gem_nameObject

Returns the value of attribute gem_name.



11
12
13
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 11

def gem_name
  @gem_name
end

#max_valueObject

modifiers on the end result image being rendered. Essentially these are the boundries of the graph



20
21
22
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 20

def max_value
  @max_value
end

#min_valueObject

modifiers on the end result image being rendered. Essentially these are the boundries of the graph



20
21
22
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 20

def min_value
  @min_value
end

#rootObject

modifiers on the end result image being rendered. Essentially these are the boundries of the graph



20
21
22
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 20

def root
  @root
end

#versionsObject

Returns the value of attribute versions.



11
12
13
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 11

def versions
  @versions
end

Instance Method Details

#effective_date_rangeObject



26
27
28
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 26

def effective_date_range
  @passed_date_range || default_date_range
end

#effective_max_valueObject



30
31
32
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 30

def effective_max_value
  @passed_max_value || default_max_value
end

#effective_min_valueObject



34
35
36
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 34

def effective_min_value
  @passed_min_value || default_min_value
end

#graph(root_arg = nil, range = nil, min = nil, max = nil) ⇒ Object



13
14
15
16
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 13

def graph(root_arg = nil, range = nil, min = nil, max = nil)
  set_overwritable_attrs(root_arg,range,min,max)
  gruff_builder.write
end

#num_downloadsObject



44
45
46
47
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 44

def num_downloads
  sum = totals.map {|t| t[:version_downloads]}.sum
  ActiveSupport::NumberHelper.number_to_delimited(sum)
end

#totalsObject



38
39
40
41
42
# File 'lib/gem_velocity/velocitators/base_velocitator.rb', line 38

def totals
  versions.map do |v|
    gem_data.total_for_version(v)
  end
end