Module: HumanDate::ViewHelpers
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/human_date/view_helpers.rb
Instance Method Summary collapse
- #human_date(object, namespace = nil) ⇒ Object (also: #human_time)
- #human_time_tag(object, namespace_or_options = nil, options = nil) ⇒ Object
Instance Method Details
#human_date(object, namespace = nil) ⇒ Object Also known as: human_time
5 6 7 |
# File 'lib/human_date/view_helpers.rb', line 5 def human_date(object, namespace = nil) I18n.localize(object, format: format_for_object(object, namespace)).strip end |
#human_time_tag(object, namespace_or_options = nil, options = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/human_date/view_helpers.rb', line 10 def human_time_tag(object, = nil, = nil) if .is_a? Hash namespace = nil = else namespace = ||= {} end .merge! datetime: object.iso8601 content_tag :time, human_time(object, namespace), end |