Class: CafeCar::RangePresenter

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

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/presenters/cafe_car/range_presenter.rb', line 3

def to_html
  min, max = object.begin, object.end
  if min.blank? && max.blank?
    ""
  elsif max.blank? || max == Float::INFINITY
    "#{min}+"
  elsif min == max
    min
  else
    "#{min}#{max}"
  end
end