Class: TimeNoTime

Inherits:
Time
  • Object
show all
Defined in:
lib/ext/time_no_time.rb

Overview

A time emulator to keep the fact that the time information was missing, even if it behaves as a Time object for the given date.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_no_time(string) ⇒ Object



24
25
26
# File 'lib/ext/time_no_time.rb', line 24

def self.parse_no_time(string)
  strptime("#{string} 00:00:00", '%Y-%m-%d %H:%M:%S')
end

Instance Method Details

#l18n_long_date_no_year_stringString

Returns the current Time instance as a localized long string

without time nor year.

Returns:

  • (String)

    the localized Time string representation



20
21
22
# File 'lib/ext/time_no_time.rb', line 20

def l18n_long_date_no_year_string
  I18n.l self, format: :long_no_time_no_year
end

#l18n_long_date_stringString

Returns the current Time instance as a localized long string

without time.

Returns:

  • (String)

    the localized Time string representation



12
13
14
# File 'lib/ext/time_no_time.rb', line 12

def l18n_long_date_string
  I18n.l self, format: :long_no_time
end