Class: CafeCar::EnumerablePresenter
- Inherits:
-
Object
- Object
- CafeCar::EnumerablePresenter
- Defined in:
- app/presenters/cafe_car/enumerable_presenter.rb
Instance Method Summary collapse
Instance Method Details
#count ⇒ Object
3 |
# File 'app/presenters/cafe_car/enumerable_presenter.rb', line 3 def count = [:count] || object.count |
#to_html ⇒ Object
6 7 8 9 10 11 |
# File 'app/presenters/cafe_car/enumerable_presenter.rb', line 6 def to_html object.map { present(_1) } .then { [:count] == object.count ? _1 : [ _1, "..." ] } .then { safe_join(_1, ", ") } .then { with_count _1 } end |
#with_count(list) ⇒ Object
4 |
# File 'app/presenters/cafe_car/enumerable_presenter.rb', line 4 def with_count(list) = t(:list_html, list:, count:) |