Class: Prosperity::Period
- Inherits:
-
Struct
- Object
- Struct
- Prosperity::Period
- Defined in:
- lib/prosperity/period.rb
Instance Attribute Summary collapse
-
#ceil_date ⇒ Object
Returns the value of attribute ceil_date.
-
#db_strf_str ⇒ Object
Returns the value of attribute db_strf_str.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#floor_date ⇒ Object
Returns the value of attribute floor_date.
-
#ruby_strf_str ⇒ Object
Returns the value of attribute ruby_strf_str.
Instance Method Summary collapse
- #actual_end_time(end_time) ⇒ Object
- #actual_start_time(start_time) ⇒ Object
- #each_period(start_time, end_time) ⇒ Object
Instance Attribute Details
#ceil_date ⇒ Object
Returns the value of attribute ceil_date
2 3 4 |
# File 'lib/prosperity/period.rb', line 2 def ceil_date @ceil_date end |
#db_strf_str ⇒ Object
Returns the value of attribute db_strf_str
2 3 4 |
# File 'lib/prosperity/period.rb', line 2 def db_strf_str @db_strf_str end |
#duration ⇒ Object
Returns the value of attribute duration
2 3 4 |
# File 'lib/prosperity/period.rb', line 2 def duration @duration end |
#floor_date ⇒ Object
Returns the value of attribute floor_date
2 3 4 |
# File 'lib/prosperity/period.rb', line 2 def floor_date @floor_date end |
#ruby_strf_str ⇒ Object
Returns the value of attribute ruby_strf_str
2 3 4 |
# File 'lib/prosperity/period.rb', line 2 def ruby_strf_str @ruby_strf_str end |
Instance Method Details
#actual_end_time(end_time) ⇒ Object
16 17 18 |
# File 'lib/prosperity/period.rb', line 16 def actual_end_time(end_time) ceil_date.call(end_time) + 1 end |
#actual_start_time(start_time) ⇒ Object
12 13 14 |
# File 'lib/prosperity/period.rb', line 12 def actual_start_time(start_time) floor_date.call(start_time) end |
#each_period(start_time, end_time) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/prosperity/period.rb', line 3 def each_period(start_time, end_time) start_time = actual_start_time(start_time) end_time = actual_end_time(end_time) + 1 while start_time <= end_time yield start_time start_time += duration end end |