Class: Hyrax::Admin::RepositoryGrowthPresenter
- Inherits:
-
Object
- Object
- Hyrax::Admin::RepositoryGrowthPresenter
- Defined in:
- app/presenters/hyrax/admin/repository_growth_presenter.rb
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(start_date, end_date) ⇒ RepositoryGrowthPresenter
constructor
A new instance of RepositoryGrowthPresenter.
Constructor Details
#initialize(start_date, end_date) ⇒ RepositoryGrowthPresenter
Returns a new instance of RepositoryGrowthPresenter.
5 6 7 8 9 |
# File 'app/presenters/hyrax/admin/repository_growth_presenter.rb', line 5 def initialize(start_date, end_date) @x_min = start_date @x_max = end_date @date_format = ->(x) { x.strftime('%F') } end |
Instance Method Details
#as_json ⇒ Object
11 12 13 14 15 |
# File 'app/presenters/hyrax/admin/repository_growth_presenter.rb', line 11 def as_json(*) works.to_a.zip(collections.to_a).map do |e| { y: e.first.first, works: e.first.last, collections: e.last.last } end end |