Class: DateInterval::Date
- Inherits:
-
Object
- Object
- DateInterval::Date
- Extended by:
- Forwardable
- Defined in:
- lib/date_interval/date.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
Instance Method Summary collapse
- #add! ⇒ Object
- #add? ⇒ Boolean
-
#initialize(date) ⇒ Date
constructor
A new instance of Date.
- #remove! ⇒ Object
- #to_date ⇒ Object
- #weekday? ⇒ Boolean
- #weekend? ⇒ Boolean
Constructor Details
#initialize(date) ⇒ Date
Returns a new instance of Date.
8 9 10 11 |
# File 'lib/date_interval/date.rb', line 8 def initialize(date) @date = date @add = true end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/date_interval/date.rb', line 3 def date @date end |
Instance Method Details
#add! ⇒ Object
17 18 19 |
# File 'lib/date_interval/date.rb', line 17 def add! @add = true end |
#add? ⇒ Boolean
13 14 15 |
# File 'lib/date_interval/date.rb', line 13 def add? @add end |
#remove! ⇒ Object
21 22 23 |
# File 'lib/date_interval/date.rb', line 21 def remove! @add = false end |
#to_date ⇒ Object
33 34 35 |
# File 'lib/date_interval/date.rb', line 33 def to_date date end |
#weekday? ⇒ Boolean
29 30 31 |
# File 'lib/date_interval/date.rb', line 29 def weekday? !weekend? end |
#weekend? ⇒ Boolean
25 26 27 |
# File 'lib/date_interval/date.rb', line 25 def weekend? [0, 6].include?(date.wday) end |