Module: Roebe::Time
- Included in:
- Shell
- Defined in:
- lib/roebe/time/time.rb
Overview
Roebe::Time
Constant Summary collapse
- DAY_NAMES =
#
Roebe::Time::DAY_NAMES
The addition of this constant was necessary due to upstream MRI ruby removing the RFC2822_DAY_NAME constant from time.rb.
#
%w( Sun Mon Tue Wed Thu Fri Sat )
- ONE_MINUTE =
#
Roebe::Time::ONE_MINUTE
#
60
- ONE_HOUR =
#
Roebe::Time::ONE_HOUR
#
60 * ONE_MINUTE
- ONE_DAY =
#
Roebe::Time::ONE_DAY
#
24 * ONE_HOUR
Class Method Summary collapse
-
.dd_mm_yyyy ⇒ Object
# === Roebe::Time.dd_mm_yyyy.
-
.get_current_month ⇒ Object
# === Roebe::Time.get_current_month.
-
.hh_mm_ss ⇒ Object
# === Roebe::Time.hh_mm_ss.
-
.return_current_year ⇒ Object
# === Roebe::Time.return_current_year.
-
.show_time ⇒ Object
# === Roebe::Time.show_time.
Instance Method Summary collapse
-
#get_current_month ⇒ Object
# === get_current_month ========================================================================= #.
-
#return_current_year ⇒ Object
(also: #current_year?)
# === return_current_year ========================================================================= #.
Class Method Details
.dd_mm_yyyy ⇒ Object
#
Roebe::Time.dd_mm_yyyy
This method will return the current day, month and year, as a String, such as:
"23.12.2018"
#
106 107 108 |
# File 'lib/roebe/time/time.rb', line 106 def self.dd_mm_yyyy ::Time.now.strftime('%d.%m.%Y') end |
.get_current_month ⇒ Object
#
Roebe::Time.get_current_month
This method will return a number from 1 to 12 reflecting the current month.
For instance, during August this method would return the String ‘08’ here. November would return ‘11’, and so on.
#
65 66 67 |
# File 'lib/roebe/time/time.rb', line 65 def self.get_current_month ::Time.now.strftime('%m') end |
.hh_mm_ss ⇒ Object
#
Roebe::Time.hh_mm_ss
This will return, as a String, the current time, in a hours-minutes-seconds format (hh:mm:ss), such as in:
"18:57:36"
In other words:
HH:MM:SS
#
123 124 125 |
# File 'lib/roebe/time/time.rb', line 123 def self.hh_mm_ss ::Time.now.strftime('%H:%M:%S') end |
.return_current_year ⇒ Object
#
Roebe::Time.return_current_year
This method will return the current year, as String.
For instance, the String “2020” will be returned if we are in the year 2020.
#
77 78 79 |
# File 'lib/roebe/time/time.rb', line 77 def self.return_current_year ::Time.now.strftime('%Y') end |
Instance Method Details
#get_current_month ⇒ Object
#
get_current_month
#
52 53 54 |
# File 'lib/roebe/time/time.rb', line 52 def get_current_month ::Roebe::Time.get_current_month end |
#return_current_year ⇒ Object Also known as: current_year?
#
return_current_year
#
84 85 86 |
# File 'lib/roebe/time/time.rb', line 84 def return_current_year ::Roebe::Time.return_current_year end |