Class: CureDateManager
- Inherits:
-
Object
- Object
- CureDateManager
- Defined in:
- lib/cureutils/cure_date_manager.rb
Overview
Date class supports the precure format
Instance Attribute Summary collapse
-
#format ⇒ Object
writeonly
Sets the attribute format.
Instance Method Summary collapse
- #datetime(datetime_str) ⇒ Object
-
#initialize ⇒ CureDateManager
constructor
A new instance of CureDateManager.
- #print_results ⇒ Object
- #source_output(output = $stdout) ⇒ Object
Constructor Details
#initialize ⇒ CureDateManager
Returns a new instance of CureDateManager.
8 9 10 11 12 13 14 |
# File 'lib/cureutils/cure_date_manager.rb', line 8 def initialize hashize_cure_date unless @birth_date || @created_date hashize_movie_date unless @movie_started_date @datetime = Time.now @format = '+%F %H:%M:%S @P' @out = $stdout end |
Instance Attribute Details
#format=(value) ⇒ Object (writeonly)
Sets the attribute format
24 25 26 |
# File 'lib/cureutils/cure_date_manager.rb', line 24 def format=(value) @format = value end |
Instance Method Details
#datetime(datetime_str) ⇒ Object
20 21 22 |
# File 'lib/cureutils/cure_date_manager.rb', line 20 def datetime(datetime_str) @datetime = datetime_str ? natural_lang2time(datetime_str) : Time.now end |
#print_results ⇒ Object
26 27 28 29 30 |
# File 'lib/cureutils/cure_date_manager.rb', line 26 def print_results updated_fmt = update_fmt(@datetime, @format) @out.puts @datetime.strftime(updated_fmt) 0 end |
#source_output(output = $stdout) ⇒ Object
16 17 18 |
# File 'lib/cureutils/cure_date_manager.rb', line 16 def source_output(output = $stdout) @out = output end |