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.



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

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



5
6
7
# File 'lib/git_stats/stats_view/view_data.rb', line 5

def repo
  @repo
end

Instance Method Details

#asset_path(asset, active_page) ⇒ Object



19
20
21
# File 'lib/git_stats/stats_view/view_data.rb', line 19

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

#chartsObject



11
12
13
# File 'lib/git_stats/stats_view/view_data.rb', line 11

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


23
24
25
# File 'lib/git_stats/stats_view/view_data.rb', line 23

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

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



15
16
17
# File 'lib/git_stats/stats_view/view_data.rb', line 15

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