Class: DateInterval::Date

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/date_interval/date.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dateObject (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

Returns:

  • (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_dateObject



33
34
35
# File 'lib/date_interval/date.rb', line 33

def to_date
  date
end

#weekday?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/date_interval/date.rb', line 29

def weekday?
  !weekend?
end

#weekend?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/date_interval/date.rb', line 25

def weekend?
  [0, 6].include?(date.wday)
end