Class: Mo2tex::ExcludeDates

Inherits:
ExcludeBase show all
Defined in:
lib/mo2tex/exclude_date.rb

Instance Attribute Summary collapse

Attributes inherited from ExcludeBase

#end_period, #start_period

Instance Method Summary collapse

Methods inherited from ExcludeBase

#skip?

Constructor Details

#initialize(sd, ed, sp, ep) ⇒ ExcludeDates

Returns a new instance of ExcludeDates.

Raises:



54
55
56
57
58
59
60
# File 'lib/mo2tex/exclude_date.rb', line 54

def initialize(sd, ed, sp, ep)
  super(sp, ep)
  @start_date = DateTime.parse(sd.to_s)
  @end_date   = DateTime.parse(ed.to_s)
  raise DateOutOfRange, self.start_date.to_s unless within_period?(self.start_date)
  raise DateOutOfRange, self.end_date.to_s unless within_period?(self.end_date)
end

Instance Attribute Details

#end_dateObject (readonly)

Returns the value of attribute end_date.



52
53
54
# File 'lib/mo2tex/exclude_date.rb', line 52

def end_date
  @end_date
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



52
53
54
# File 'lib/mo2tex/exclude_date.rb', line 52

def start_date
  @start_date
end

Instance Method Details

#does_it_skip?(d) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/mo2tex/exclude_date.rb', line 62

def does_it_skip?(d)
  return (d >= self.start_date && d <= self.end_date)
end