Class: Centra::DateRange

Inherits:
Struct
  • Object
show all
Defined in:
lib/centra/date_range.rb,
lib/centra/date_range.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date

Returns:

  • (Object)

    the current value of end_date



2
3
4
# File 'lib/centra/date_range.rb', line 2

def end_date
  @end_date
end

#start_dateObject

Returns the value of attribute start_date

Returns:

  • (Object)

    the current value of start_date



2
3
4
# File 'lib/centra/date_range.rb', line 2

def start_date
  @start_date
end

Instance Method Details

#cover?(timestamp) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
# File 'lib/centra/date_range.rb', line 5

def cover?(timestamp)
  return false if start_date && timestamp < start_date
  return false if end_date && timestamp > end_date

  true
end