Class: CafeCar::EnumerablePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/cafe_car/enumerable_presenter.rb

Instance Method Summary collapse

Instance Method Details

#countObject



3
# File 'app/presenters/cafe_car/enumerable_presenter.rb', line 3

def count            = options[:count] || object.count

#to_htmlObject



6
7
8
9
10
11
# File 'app/presenters/cafe_car/enumerable_presenter.rb', line 6

def to_html
  object.map  { present(_1) }
        .then { options[: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:)