Class: GitStats::StatsView::ViewData

Inherits:
Object
  • Object
show all
Includes:
LazyHighCharts::LayoutHelper
Defined in:
lib/git_stats/stats_view/view_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ ViewData

Returns a new instance of ViewData.



9
10
11
# File 'lib/git_stats/stats_view/view_data.rb', line 9

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



7
8
9
# File 'lib/git_stats/stats_view/view_data.rb', line 7

def repo
  @repo
end

Instance Method Details

#asset_path(asset, active_page) ⇒ Object



21
22
23
# File 'lib/git_stats/stats_view/view_data.rb', line 21

def asset_path(asset, active_page)
  Pathname.new("/assets/#{asset}").relative_path_from(Pathname.new("/#{active_page}").dirname)
end

#chartsObject



13
14
15
# File 'lib/git_stats/stats_view/view_data.rb', line 13

def charts
  @charts ||= Charts::All.new(repo)
end


25
26
27
# File 'lib/git_stats/stats_view/view_data.rb', line 25

def link_to(href, active_page)
  Pathname.new("/#{href}").relative_path_from(Pathname.new("/#{active_page}").dirname)
end

#render_partial(template_name, params = {}) ⇒ Object



17
18
19
# File 'lib/git_stats/stats_view/view_data.rb', line 17

def render_partial(template_name, params = {})
  Template.new(template_name).render(self, params)
end