Class: ExistClient::ReportPeriod
- Inherits:
-
Object
- Object
- ExistClient::ReportPeriod
- Includes:
- LogicalDate
- Defined in:
- lib/exist_client/report_period.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
- #include?(time) ⇒ Boolean
-
#initialize(last_report_date) ⇒ ReportPeriod
constructor
A new instance of ReportPeriod.
- #valid? ⇒ Boolean
Methods included from LogicalDate
Constructor Details
#initialize(last_report_date) ⇒ ReportPeriod
Returns a new instance of ReportPeriod.
7 8 9 10 11 12 13 |
# File 'lib/exist_client/report_period.rb', line 7 def initialize(last_report_date) date = last_report_date + 1 end_date = logical_date(Time.now) @start_time = Time.new(date.year, date.month, date.day, Config.cutoff_hour) @end_time = Time.new(end_date.year, end_date.month, end_date.day, Config.cutoff_hour) - 1 end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
5 6 7 |
# File 'lib/exist_client/report_period.rb', line 5 def end_time @end_time end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
5 6 7 |
# File 'lib/exist_client/report_period.rb', line 5 def start_time @start_time end |
Instance Method Details
#include?(time) ⇒ Boolean
19 20 21 |
# File 'lib/exist_client/report_period.rb', line 19 def include?(time) time.between?(start_time, end_time) end |
#valid? ⇒ Boolean
15 16 17 |
# File 'lib/exist_client/report_period.rb', line 15 def valid? start_time < end_time end |