Class: Week
- Inherits:
-
Object
- Object
- Week
- Defined in:
- lib/dude_weak.rb
Defined Under Namespace
Classes: Day
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
- #days ⇒ Object
-
#initialize(time) ⇒ Week
constructor
A new instance of Week.
- #monday ⇒ Object
- #next ⇒ Object
- #number ⇒ Object
- #previous ⇒ Object
- #year ⇒ Object
Constructor Details
#initialize(time) ⇒ Week
Returns a new instance of Week.
9 10 11 12 |
# File 'lib/dude_weak.rb', line 9 def initialize(time) @time = time @date = time.to_date end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
7 8 9 |
# File 'lib/dude_weak.rb', line 7 def date @date end |
#time ⇒ Object
Returns the value of attribute time.
7 8 9 |
# File 'lib/dude_weak.rb', line 7 def time @time end |
Instance Method Details
#days ⇒ Object
34 35 36 37 38 39 |
# File 'lib/dude_weak.rb', line 34 def days @days ||= [] return @days unless @days.empty? build_days @days end |
#monday ⇒ Object
30 31 32 |
# File 'lib/dude_weak.rb', line 30 def monday @time.monday end |
#next ⇒ Object
22 23 24 |
# File 'lib/dude_weak.rb', line 22 def next self.class.new(@date.next_week) end |
#number ⇒ Object
18 19 20 |
# File 'lib/dude_weak.rb', line 18 def number @date.cweek end |
#previous ⇒ Object
26 27 28 |
# File 'lib/dude_weak.rb', line 26 def previous self.class.new(@date.prev_week) end |
#year ⇒ Object
14 15 16 |
# File 'lib/dude_weak.rb', line 14 def year @date.cwyear end |